Skip to content

Commit

Permalink
add Reihenfolge and Richtung to Steig
Browse files Browse the repository at this point in the history
fix listSteige being empty
  • Loading branch information
alexnavratil committed Aug 1, 2018
1 parent ffdd165 commit 587b631
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'at.alexnavratil'
version '1.0-SNAPSHOT'
version '1.1-SNAPSHOT'

sourceCompatibility = 1.8

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
import okhttp3.Request;
import okhttp3.Response;

import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class EchtzeitdatenApi {
Expand Down Expand Up @@ -68,8 +66,10 @@ public void readStaticData() throws IOException {
Integer.parseInt(row.getField("STEIG_ID")),
Integer.parseInt(row.getField("FK_HALTESTELLEN_ID")),
linieIndexMap.get(Integer.parseInt(row.getField("FK_LINIEN_ID"))),
Integer.parseInt(row.getField("RBL_NUMMER"))
);
Integer.parseInt(row.getField("RBL_NUMMER")),
Integer.parseInt(row.getField("REIHENFOLGE")),
parseRichtung(row.getField("RICHTUNG")));
this.steigList.add(s);
if (steigHaltestellenIndexMap.containsKey(s.getHaltestellenId())) {
steigHaltestellenIndexMap.get(s.getHaltestellenId()).add(s);
} else {
Expand Down Expand Up @@ -124,6 +124,10 @@ private TransferType parseType(String type){
}
}

private Richtung parseRichtung(String richtung) {
return richtung.equals("H") ? Richtung.H : Richtung.R;
}

public List<Haltestelle> listHaltestellen(){
if(!readStaticData) {
throw new IllegalStateException("Please call readStaticData before calling any static data method");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package at.alexnavratil.echtzeitdaten.model;

public enum Richtung {
H,
R
}
16 changes: 15 additions & 1 deletion src/main/java/at/alexnavratil/echtzeitdaten/model/Steig.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ public class Steig {
private final int haltestellenId;
private final Linie linie;
private final int rbl;
private final int reihenfolge;
private final Richtung richtung;

public Steig(int id, int haltestellenId, Linie linie, int rbl) {
public Steig(int id, int haltestellenId, Linie linie, int rbl, int reihenfolge, Richtung richtung) {
this.id = id;
this.haltestellenId = haltestellenId;
this.linie = linie;
this.rbl = rbl;
this.reihenfolge = reihenfolge;
this.richtung = richtung;
}

public int getId() {
Expand All @@ -31,6 +35,14 @@ public int getRbl() {
return rbl;
}

public int getReihenfolge() {
return reihenfolge;
}

public Richtung getRichtung() {
return richtung;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -51,6 +63,8 @@ public String toString() {
", haltestellenId=" + haltestellenId +
", linie=" + linie +
", rbl=" + rbl +
", reihenfolge=" + reihenfolge +
", richtung=" + richtung +
'}';
}
}

0 comments on commit 587b631

Please sign in to comment.