-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
351 additions
and
477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
core/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.mobilitydata.gtfsvalidator.table; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public abstract class GtfsContainer<T extends GtfsEntity, D extends GtfsDescriptor> { | ||
|
||
private final D descriptor; | ||
private final TableStatus tableStatus; | ||
|
||
public GtfsContainer(D descriptor, TableStatus tableStatus) { | ||
this.tableStatus = tableStatus; | ||
this.descriptor = descriptor; | ||
} | ||
|
||
public TableStatus getTableStatus() { | ||
return tableStatus; | ||
} | ||
|
||
public D getDescriptor() { | ||
return descriptor; | ||
} | ||
|
||
public abstract Class<T> getEntityClass(); | ||
|
||
public int entityCount() { | ||
return getEntities().size(); | ||
} | ||
|
||
public abstract List<T> getEntities(); | ||
|
||
public abstract String gtfsFilename(); | ||
|
||
public abstract Optional<T> byTranslationKey(String recordId, String recordSubId); | ||
|
||
public boolean isMissingFile() { | ||
return tableStatus == TableStatus.MISSING_FILE; | ||
} | ||
|
||
public boolean isParsedSuccessfully() { | ||
switch (tableStatus) { | ||
case PARSABLE_HEADERS_AND_ROWS: | ||
return true; | ||
case MISSING_FILE: | ||
return !descriptor.isRequired(); | ||
default: | ||
return false; | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
core/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.mobilitydata.gtfsvalidator.table; | ||
|
||
// TODO: review class name maybe GtfsFileDescriptor | ||
public abstract class GtfsDescriptor<T extends GtfsEntity> { | ||
|
||
public abstract <C extends GtfsContainer> C createContainerForInvalidStatus( | ||
TableStatus tableStatus); | ||
|
||
// True if the specified file is required in a feed. | ||
private boolean required; | ||
|
||
private TableStatus tableStatus; | ||
|
||
public abstract boolean isRecommended(); | ||
|
||
public abstract Class<T> getEntityClass(); | ||
|
||
public abstract String gtfsFilename(); | ||
|
||
public boolean isRequired() { | ||
return this.required; | ||
} | ||
|
||
public void setRequired(boolean required) { | ||
this.required = required; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
core/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsJsonContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.mobilitydata.gtfsvalidator.table; | ||
|
||
public abstract class GtfsJsonContainer<T extends GtfsEntity, D extends GtfsDescriptor<T>> | ||
extends GtfsContainer<T, D> { | ||
|
||
public GtfsJsonContainer(D descriptor, TableStatus tableStatus) { | ||
super(descriptor, tableStatus); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
core/src/main/java/org/mobilitydata/gtfsvalidator/table/GtfsJsonDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.mobilitydata.gtfsvalidator.table; | ||
|
||
import java.util.List; | ||
import org.mobilitydata.gtfsvalidator.notice.NoticeContainer; | ||
|
||
public abstract class GtfsJsonDescriptor<T extends GtfsEntity> extends GtfsDescriptor<T> { | ||
|
||
public abstract GtfsJsonContainer createContainerForEntities( | ||
List<T> entities, NoticeContainer noticeContainer); | ||
} |
Oops, something went wrong.