Skip to content

Commit

Permalink
Change in response to a clarification of the Flex v2 spec, as well as…
Browse files Browse the repository at this point in the history
… changes to compile on JDK versions > 8
  • Loading branch information
jeffmaki committed Aug 25, 2021
1 parent 7bc7a9e commit 7721f34
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 65 deletions.
27 changes: 21 additions & 6 deletions onebusaway-gtfs-transformer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,21 @@
<version>1.3.101-SNAPSHOT</version>
</parent>


<dependencies>

<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-gtfs</artifactId>
<version>1.3.101-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.onebusaway</groupId>
<artifactId>onebusaway-collections</artifactId>
</dependency>

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand All @@ -47,7 +42,6 @@
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.kurtraschke</groupId>
<artifactId>wsf-api</artifactId>
Expand All @@ -58,6 +52,18 @@
<artifactId>onebusaway-cloud-noop</artifactId>
<version>0.0.10</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
</dependency>
</dependencies>

<build>
Expand All @@ -72,6 +78,15 @@
</excludes>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ public class StopTimeArray extends AbstractList<StopTime> {

private BookingRule[] dropOffBookingRules = new BookingRule[0];

private int[] meanOffsets = new int[0];
private double[] meanOffsets = new double[0];

private int[] safeOffsets = new int[0];
private double[] safeOffsets = new double[0];

private int[] meanFactors = new int[0];
private double[] meanFactors = new double[0];

private int[] safeFactors = new int[0];
private double[] safeFactors = new double[0];

public void trimToSize() {
setLength(size);
Expand Down Expand Up @@ -396,42 +396,42 @@ public void setDropOffBookingRule(BookingRule dropOffBookingRule) {
}

@Override
public int getMeanDurationFactor() {
public double getMeanDurationFactor() {
return meanOffsets[index];
}

@Override
public void setMeanDurationFactor(int meanDurationFactor) {
public void setMeanDurationFactor(double meanDurationFactor) {
meanFactors[index] = meanDurationFactor;
}

@Override
public int getMeanDurationOffset() {
public double getMeanDurationOffset() {
return meanOffsets[index];
}

@Override
public void setMeanDurationOffset(int meanDurationOffset) {
public void setMeanDurationOffset(double meanDurationOffset) {
meanOffsets[index] = meanDurationOffset;
}

@Override
public int getSafeDurationFactor() {
public double getSafeDurationFactor() {
return safeFactors[index];
}

@Override
public void setSafeDurationFactor(int safeDurationFactor) {
public void setSafeDurationFactor(double safeDurationFactor) {
safeFactors[index] = safeDurationFactor;
}

@Override
public int getSafeDurationOffset() {
public double getSafeDurationOffset() {
return safeOffsets[index];
}

@Override
public void setSafeDurationOffset(int safeDurationOffset) {
public void setSafeDurationOffset(double safeDurationOffset) {
safeOffsets[index] = safeDurationOffset;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,16 @@ public final class StopTime extends IdentityBean<Integer> implements

// See https://github.com/MobilityData/gtfs-flex/blob/master/spec/reference.md
@CsvField(optional = true, name = "mean_duration_factor")
private int meanDurationFactor = MISSING_VALUE;
private double meanDurationFactor = MISSING_VALUE;

@CsvField(optional = true, name = "mean_duration_offset", mapping = StopTimeFieldMappingFactory.class)
private int meanDurationOffset = MISSING_VALUE;
@CsvField(optional = true, name = "mean_duration_offset")
private double meanDurationOffset = MISSING_VALUE;

@CsvField(optional = true, name = "safe_duration_factor")
private int safeDurationFactor = MISSING_VALUE;
private double safeDurationFactor = MISSING_VALUE;

@CsvField(optional = true, name = "safe_duration_offset", mapping = StopTimeFieldMappingFactory.class)
private int safeDurationOffset = MISSING_VALUE;
@CsvField(optional = true, name = "safe_duration_offset")
private double safeDurationOffset = MISSING_VALUE;

public StopTime() {

Expand Down Expand Up @@ -650,45 +650,45 @@ public String toString() {
+ ")";
}

public int getMeanDurationFactor() {
public double getMeanDurationFactor() {
return meanDurationFactor;
}

public void setMeanDurationFactor(int meanDurationFactor) {
public void setMeanDurationFactor(double meanDurationFactor) {
this.meanDurationFactor = meanDurationFactor;
}

public int getMeanDurationOffset() {
public double getMeanDurationOffset() {
return meanDurationOffset;
}

public void setMeanDurationOffset(int meanDurationOffset) {
public void setMeanDurationOffset(double meanDurationOffset) {
this.meanDurationOffset = meanDurationOffset;
}

public int getSafeDurationFactor() {
public double getSafeDurationFactor() {
if (proxy != null) {
return proxy.getSafeDurationFactor();
}
return this.safeDurationFactor;
}

public void setSafeDurationFactor(int safeDurationFactor) {
public void setSafeDurationFactor(double safeDurationFactor) {
if (proxy != null) {
proxy.setSafeDurationFactor(safeDurationFactor);
return;
}
this.safeDurationFactor = safeDurationFactor;
}

public int getSafeDurationOffset() {
public double getSafeDurationOffset() {
if (proxy != null) {
return proxy.getSafeDurationOffset();
}
return this.safeDurationOffset;
}

public void setSafeDurationOffset(int safeDurationOffset) {
public void setSafeDurationOffset(double safeDurationOffset) {
if (proxy != null) {
proxy.setSafeDurationOffset(safeDurationOffset);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,19 @@ public interface StopTimeProxy {

public void setDropOffBookingRule(BookingRule dropOffBookingRule);

public int getMeanDurationFactor();
public double getMeanDurationFactor();

public void setMeanDurationFactor(int meanDurationFactor);
public void setMeanDurationFactor(double meanDurationFactor);

public int getMeanDurationOffset();
public double getMeanDurationOffset();

public void setMeanDurationOffset(int meanDurationOffset);
public void setMeanDurationOffset(double meanDurationOffset);

public int getSafeDurationFactor();
public double getSafeDurationFactor();

public void setSafeDurationFactor(int safeDurationFactor);
public void setSafeDurationFactor(double safeDurationFactor);

public int getSafeDurationOffset();
public double getSafeDurationOffset();

public void setSafeDurationOffset(int safeDurationOffset);
public void setSafeDurationOffset(double safeDurationOffset);
}
80 changes: 55 additions & 25 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,32 +110,62 @@
<version>1.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<!-- This plugin must be configured both here (for attach-javadoc during release)
and in "reports" (for site generation), preferably with identical version numbers. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<!-- Turn off Java 8 strict Javadoc checking -->
<additionalparam>-Xdoclint:none</additionalparam>
<source>8</source>
</configuration>
<executions>
<!-- Compress Javadoc into JAR and include that JAR when deploying. -->
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<build>
<plugins>
<plugin>
<!-- This plugin must be configured both here (for attach-javadoc during
release) and in "reports" (for site generation), preferably with identical
version numbers. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<!-- Turn off Java 8 strict Javadoc checking -->
<additionalparam>-Xdoclint:none</additionalparam>
<source>8</source>
<failOnError>false</failOnError>
</configuration>
<executions>
<!-- Compress Javadoc into JAR and include that JAR when deploying. -->
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.1</version>
</plugin>
</plugins>
</build>
</project>

0 comments on commit 7721f34

Please sign in to comment.