mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-18 00:09:55 +00:00
use Line dto consistently
git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@700 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
parent
4a73175244
commit
36185b840c
16 changed files with 84 additions and 113 deletions
|
@ -1112,8 +1112,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
final String destinationIdStr = pp.getAttributeValue(null, "destID");
|
||||
final int destinationId = destinationIdStr.length() > 0 ? Integer.parseInt(destinationIdStr) : 0;
|
||||
|
||||
final String lineStr = processItdServingLine(pp);
|
||||
final LineDestination line = new LineDestination(lineStr, lineColors(lineStr), destinationId, destination);
|
||||
final LineDestination line = new LineDestination(processItdServingLine(pp), destinationId, destination);
|
||||
|
||||
StationDepartures assignedStationDepartures;
|
||||
if (assignedStopId == 0)
|
||||
|
@ -1177,14 +1176,14 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
final String destination = normalizeLocationName(pp.getAttributeValue(null, "direction"));
|
||||
final int destinationId = Integer.parseInt(pp.getAttributeValue(null, "destID"));
|
||||
|
||||
final String line = processItdServingLine(pp);
|
||||
final Line line = processItdServingLine(pp);
|
||||
|
||||
if (isRealtime && !predictedDepartureTime.isSet(Calendar.HOUR_OF_DAY))
|
||||
predictedDepartureTime.setTimeInMillis(plannedDepartureTime.getTimeInMillis());
|
||||
|
||||
final Departure departure = new Departure(plannedDepartureTime.getTime(),
|
||||
predictedDepartureTime.isSet(Calendar.HOUR_OF_DAY) ? predictedDepartureTime.getTime() : null, line, lineColors(line),
|
||||
null, position, destinationId, destination, null, null);
|
||||
predictedDepartureTime.isSet(Calendar.HOUR_OF_DAY) ? predictedDepartureTime.getTime() : null, line, position,
|
||||
destinationId, destination, null, null);
|
||||
assignedStationDepartures.departures.add(departure);
|
||||
|
||||
XmlPullUtil.exit(pp, "itdDeparture");
|
||||
|
@ -1224,6 +1223,30 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
return null;
|
||||
}
|
||||
|
||||
private Location processItdPointAttributes(final XmlPullParser pp)
|
||||
{
|
||||
final int id = Integer.parseInt(pp.getAttributeValue(null, "stopID"));
|
||||
|
||||
final String place = normalizeLocationName(pp.getAttributeValue(null, "locality"));
|
||||
String name = normalizeLocationName(pp.getAttributeValue(null, "nameWO"));
|
||||
if (name == null)
|
||||
name = normalizeLocationName(pp.getAttributeValue(null, "name"));
|
||||
|
||||
final int lat, lon;
|
||||
if ("WGS84".equals(pp.getAttributeValue(null, "mapName")))
|
||||
{
|
||||
lat = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
||||
lon = Integer.parseInt(pp.getAttributeValue(null, "x"));
|
||||
}
|
||||
else
|
||||
{
|
||||
lat = 0;
|
||||
lon = 0;
|
||||
}
|
||||
|
||||
return new Location(LocationType.STATION, id, lat, lon, place, name);
|
||||
}
|
||||
|
||||
private boolean processItdDateTime(final XmlPullParser pp, final Calendar calendar) throws XmlPullParserException, IOException
|
||||
{
|
||||
XmlPullUtil.enter(pp);
|
||||
|
@ -1261,11 +1284,12 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
XmlPullUtil.next(pp);
|
||||
}
|
||||
|
||||
private String processItdServingLine(final XmlPullParser pp) throws XmlPullParserException, IOException
|
||||
private Line processItdServingLine(final XmlPullParser pp) throws XmlPullParserException, IOException
|
||||
{
|
||||
XmlPullUtil.require(pp, "itdServingLine");
|
||||
final String motType = pp.getAttributeValue(null, "motType");
|
||||
final String number = pp.getAttributeValue(null, "number");
|
||||
final String id = pp.getAttributeValue(null, "stateless");
|
||||
|
||||
XmlPullUtil.enter(pp, "itdServingLine");
|
||||
String noTrainName = null;
|
||||
|
@ -1273,7 +1297,8 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
noTrainName = pp.getAttributeValue(null, "name");
|
||||
XmlPullUtil.exit(pp, "itdServingLine");
|
||||
|
||||
return parseLine(motType, number, number, noTrainName);
|
||||
final String label = parseLine(motType, number, number, noTrainName);
|
||||
return new Line(id, label, lineColors(label));
|
||||
}
|
||||
|
||||
private static final Pattern P_STATION_NAME_WHITESPACE = Pattern.compile("\\s+");
|
||||
|
@ -1565,24 +1590,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
XmlPullUtil.test(pp, "itdPoint");
|
||||
if (!"departure".equals(pp.getAttributeValue(null, "usage")))
|
||||
throw new IllegalStateException();
|
||||
final int departureId = Integer.parseInt(pp.getAttributeValue(null, "stopID"));
|
||||
final String departurePlace = normalizeLocationName(pp.getAttributeValue(null, "locality"));
|
||||
String departureName = normalizeLocationName(pp.getAttributeValue(null, "nameWO"));
|
||||
if (departureName == null)
|
||||
departureName = normalizeLocationName(pp.getAttributeValue(null, "name"));
|
||||
final int departureLat, departureLon;
|
||||
if ("WGS84".equals(pp.getAttributeValue(null, "mapName")))
|
||||
{
|
||||
departureLat = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
||||
departureLon = Integer.parseInt(pp.getAttributeValue(null, "x"));
|
||||
}
|
||||
else
|
||||
{
|
||||
departureLat = 0;
|
||||
departureLon = 0;
|
||||
}
|
||||
final Location departure = new Location(LocationType.STATION, departureId, departureLat, departureLon, departurePlace,
|
||||
departureName);
|
||||
final Location departure = processItdPointAttributes(pp);
|
||||
if (firstDeparture == null)
|
||||
firstDeparture = departure;
|
||||
final String departurePosition = normalizePlatform(pp.getAttributeValue(null, "platform"),
|
||||
|
@ -1610,23 +1618,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
XmlPullUtil.test(pp, "itdPoint");
|
||||
if (!"arrival".equals(pp.getAttributeValue(null, "usage")))
|
||||
throw new IllegalStateException();
|
||||
final int arrivalId = Integer.parseInt(pp.getAttributeValue(null, "stopID"));
|
||||
final String arrivalPlace = normalizeLocationName(pp.getAttributeValue(null, "locality"));
|
||||
String arrivalName = normalizeLocationName(pp.getAttributeValue(null, "nameWO"));
|
||||
if (arrivalName == null)
|
||||
arrivalName = normalizeLocationName(pp.getAttributeValue(null, "name"));
|
||||
final int arrivalLat, arrivalLon;
|
||||
if ("WGS84".equals(pp.getAttributeValue(null, "mapName")))
|
||||
{
|
||||
arrivalLat = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
||||
arrivalLon = Integer.parseInt(pp.getAttributeValue(null, "x"));
|
||||
}
|
||||
else
|
||||
{
|
||||
arrivalLat = 0;
|
||||
arrivalLon = 0;
|
||||
}
|
||||
final Location arrival = new Location(LocationType.STATION, arrivalId, arrivalLat, arrivalLon, arrivalPlace, arrivalName);
|
||||
final Location arrival = processItdPointAttributes(pp);
|
||||
lastArrival = arrival;
|
||||
final String arrivalPosition = normalizePlatform(pp.getAttributeValue(null, "platform"),
|
||||
pp.getAttributeValue(null, "platformName"));
|
||||
|
@ -1699,7 +1691,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
else
|
||||
lineStr = parseLine(pp.getAttributeValue(null, "motType"), pp.getAttributeValue(null, "shortname"),
|
||||
pp.getAttributeValue(null, "name"), null);
|
||||
final Line line = new Line(lineStr, lineColors(lineStr));
|
||||
final Line line = new Line(null, lineStr, lineColors(lineStr));
|
||||
|
||||
XmlPullUtil.enter(pp, "itdMeansOfTransport");
|
||||
XmlPullUtil.exit(pp, "itdMeansOfTransport");
|
||||
|
@ -1720,19 +1712,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
intermediateStops = new LinkedList<Stop>();
|
||||
while (XmlPullUtil.test(pp, "itdPoint"))
|
||||
{
|
||||
final int stopId = Integer.parseInt(pp.getAttributeValue(null, "stopID"));
|
||||
final String stopName = normalizeLocationName(pp.getAttributeValue(null, "name"));
|
||||
final int stopLat, stopLon;
|
||||
if ("WGS84".equals(pp.getAttributeValue(null, "mapName")))
|
||||
{
|
||||
stopLat = Integer.parseInt(pp.getAttributeValue(null, "y"));
|
||||
stopLon = Integer.parseInt(pp.getAttributeValue(null, "x"));
|
||||
}
|
||||
else
|
||||
{
|
||||
stopLat = 0;
|
||||
stopLon = 0;
|
||||
}
|
||||
final Location stopLocation = processItdPointAttributes(pp);
|
||||
final String stopPosition = normalizePlatform(pp.getAttributeValue(null, "platform"),
|
||||
pp.getAttributeValue(null, "platformName"));
|
||||
XmlPullUtil.enter(pp, "itdPoint");
|
||||
|
@ -1742,8 +1722,7 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
XmlPullUtil.exit(pp, "itdPoint");
|
||||
|
||||
if (success1 || success2)
|
||||
intermediateStops.add(new Stop(new Location(LocationType.STATION, stopId, stopLat, stopLon, null, stopName),
|
||||
stopPosition, time.getTime()));
|
||||
intermediateStops.add(new Stop(stopLocation, stopPosition, time.getTime()));
|
||||
}
|
||||
XmlPullUtil.exit(pp, "itdStopSeq");
|
||||
|
||||
|
@ -1751,11 +1730,11 @@ public abstract class AbstractEfaProvider implements NetworkProvider
|
|||
final int size = intermediateStops.size();
|
||||
if (size >= 2)
|
||||
{
|
||||
if (intermediateStops.get(size - 1).location.id != arrivalId)
|
||||
if (intermediateStops.get(size - 1).location.id != arrival.id)
|
||||
throw new IllegalStateException();
|
||||
intermediateStops.remove(size - 1);
|
||||
|
||||
if (intermediateStops.get(0).location.id != departureId)
|
||||
if (intermediateStops.get(0).location.id != departure.id)
|
||||
throw new IllegalStateException();
|
||||
intermediateStops.remove(0);
|
||||
}
|
||||
|
|
|
@ -558,8 +558,8 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
message = null;
|
||||
}
|
||||
|
||||
departures.add(new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, line,
|
||||
line != null ? lineColors(line) : null, null, position, destinationId, destination, capacity, message));
|
||||
departures.add(new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, new Line(null, line,
|
||||
line != null ? lineColors(line) : null), position, destinationId, destination, capacity, message));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -873,7 +873,7 @@ public abstract class AbstractHafasProvider implements NetworkProvider
|
|||
category = shortCategory;
|
||||
|
||||
final String lineStr = normalizeLine(category, name);
|
||||
line = new Line(lineStr, lineColors(lineStr));
|
||||
line = new Line(null, lineStr, lineColors(lineStr));
|
||||
}
|
||||
else if (tag.equals("Walk") || tag.equals("Transfer") || tag.equals("GisRoute"))
|
||||
{
|
||||
|
|
|
@ -420,7 +420,7 @@ public final class BahnProvider extends AbstractHafasProvider
|
|||
if (mDetFine.group(2) != null)
|
||||
{
|
||||
final String lineStr = normalizeLine(ParserUtils.resolveEntities(mDetFine.group(2)));
|
||||
final Line line = new Line(lineStr, lineColors(lineStr));
|
||||
final Line line = new Line(null, lineStr, lineColors(lineStr));
|
||||
|
||||
final Calendar departureTime = new GregorianCalendar(timeZone());
|
||||
departureTime.clear();
|
||||
|
|
|
@ -321,8 +321,8 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
|
||||
final String destination = ParserUtils.resolveEntities(mDepFine.group(4));
|
||||
|
||||
final Departure dep = new Departure(plannedTime, predictedTime, line, line != null ? lineColors(line) : null, null, position,
|
||||
destinationId, destination, null, messages.get(line));
|
||||
final Departure dep = new Departure(plannedTime, predictedTime, new Line(null, line, line != null ? lineColors(line) : null),
|
||||
position, destinationId, destination, null, messages.get(line));
|
||||
if (!departures.contains(dep))
|
||||
departures.add(dep);
|
||||
}
|
||||
|
@ -391,8 +391,8 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
|
||||
final String destination = ParserUtils.resolveEntities(mDepFine.group(5));
|
||||
|
||||
final Departure dep = new Departure(plannedTime, null, line, line != null ? lineColors(line) : null, null, position,
|
||||
destinationId, destination, null, null);
|
||||
final Departure dep = new Departure(plannedTime, null, new Line(null, line, line != null ? lineColors(line) : null),
|
||||
position, destinationId, destination, null, null);
|
||||
if (!departures.contains(dep))
|
||||
departures.add(dep);
|
||||
}
|
||||
|
@ -831,7 +831,7 @@ public final class BvgProvider extends AbstractHafasProvider
|
|||
: null;
|
||||
|
||||
final String lineStr = normalizeLine(ParserUtils.resolveEntities(tDep[3]));
|
||||
final Line line = new Line(lineStr, lineColors(lineStr));
|
||||
final Line line = new Line(null, lineStr, lineColors(lineStr));
|
||||
|
||||
final Location destination;
|
||||
if (mDetails.group(3) != null)
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -234,8 +235,8 @@ public class InvgProvider extends AbstractHafasProvider
|
|||
|
||||
final String position = mDepFine.group(7) != null ? "Gl. " + ParserUtils.resolveEntities(mDepFine.group(7)) : null;
|
||||
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, line,
|
||||
line != null ? lineColors(line) : null, null, position, destinationId, destination, null, null);
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, new Line(
|
||||
null, line, line != null ? lineColors(line) : null), position, destinationId, destination, null, null);
|
||||
|
||||
if (!departures.contains(dep))
|
||||
departures.add(dep);
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -211,8 +212,8 @@ public class NasaProvider extends AbstractHafasProvider
|
|||
|
||||
final String position = mDepFine.group(7) != null ? "Gl. " + ParserUtils.resolveEntities(mDepFine.group(7)) : null;
|
||||
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, line,
|
||||
line != null ? lineColors(line) : null, null, position, destinationId, destination, null, null);
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, new Line(
|
||||
null, line, line != null ? lineColors(line) : null), position, destinationId, destination, null, null);
|
||||
|
||||
if (!departures.contains(dep))
|
||||
departures.add(dep);
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -164,7 +165,8 @@ public class NsProvider extends AbstractHafasProvider
|
|||
|
||||
mDepFine.group(4); // TODO delay
|
||||
|
||||
final Departure dep = new Departure(parsedTime.getTime(), line, line != null ? lineColors(line) : null, null, 0, destination);
|
||||
final Departure dep = new Departure(parsedTime.getTime(), null, new Line(null, line, line != null ? lineColors(line) : null),
|
||||
null, 0, destination, null, null);
|
||||
|
||||
if (!departures.contains(dep))
|
||||
departures.add(dep);
|
||||
|
|
|
@ -443,7 +443,7 @@ public class OebbProvider extends AbstractHafasProvider
|
|||
final String departurePosition = mDetFine.group(5) != null ? ParserUtils.resolveEntities(mDetFine.group(5)) : null;
|
||||
|
||||
final String lineStr = normalizeLine(lineType, ParserUtils.resolveEntities(mDetFine.group(7)));
|
||||
final Line line = new Line(lineStr, lineColors(lineStr));
|
||||
final Line line = new Line(null, lineStr, lineColors(lineStr));
|
||||
|
||||
if (arrivalId == 0)
|
||||
throw new IllegalStateException("arrivalId");
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -219,8 +220,8 @@ public class RmvProvider extends AbstractHafasProvider
|
|||
|
||||
final String position = ParserUtils.resolveEntities(ParserUtils.selectNotNull(mDepFine.group(5), mDepFine.group(6)));
|
||||
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, line,
|
||||
line != null ? lineColors(line) : null, null, position, 0, destination, null, null);
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, new Line(
|
||||
null, line, line != null ? lineColors(line) : null), position, 0, destination, null, null);
|
||||
|
||||
if (!departures.contains(dep))
|
||||
departures.add(dep);
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -231,8 +232,8 @@ public class SeptaProvider extends AbstractHafasProvider
|
|||
|
||||
final String position = mDepFine.group(7) != null ? "Gl. " + ParserUtils.resolveEntities(mDepFine.group(7)) : null;
|
||||
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, line,
|
||||
line != null ? lineColors(line) : null, null, position, destinationId, destination, null, null);
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, new Line(null,
|
||||
line, line != null ? lineColors(line) : null), position, destinationId, destination, null, null);
|
||||
|
||||
if (!departures.contains(dep))
|
||||
departures.add(dep);
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -210,8 +211,8 @@ public class ShProvider extends AbstractHafasProvider
|
|||
|
||||
final String position = mDepFine.group(7) != null ? "Gl. " + ParserUtils.resolveEntities(mDepFine.group(7)) : null;
|
||||
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, line,
|
||||
line != null ? lineColors(line) : null, null, position, destinationId, destination, null, null);
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, new Line(
|
||||
null, line, line != null ? lineColors(line) : null), position, destinationId, destination, null, null);
|
||||
|
||||
if (!departures.contains(dep))
|
||||
departures.add(dep);
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -168,8 +169,8 @@ public class SncbProvider extends AbstractHafasProvider
|
|||
|
||||
final String position = mDepFine.group(5);
|
||||
|
||||
final Departure dep = new Departure(parsedTime.getTime(), line, line != null ? lineColors(line) : null, position, 0,
|
||||
destination);
|
||||
final Departure dep = new Departure(parsedTime.getTime(), null, new Line(null, line, line != null ? lineColors(line) : null),
|
||||
position, 0, destination, null, null);
|
||||
|
||||
if (!departures.contains(dep))
|
||||
departures.add(dep);
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
import de.schildbach.pte.dto.Departure;
|
||||
import de.schildbach.pte.dto.Line;
|
||||
import de.schildbach.pte.dto.Location;
|
||||
import de.schildbach.pte.dto.LocationType;
|
||||
import de.schildbach.pte.dto.NearbyStationsResult;
|
||||
|
@ -222,8 +223,8 @@ public class VgsProvider extends AbstractHafasProvider
|
|||
|
||||
final String position = mDepFine.group(7) != null ? "Gl. " + ParserUtils.resolveEntities(mDepFine.group(7)) : null;
|
||||
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, line,
|
||||
line != null ? lineColors(line) : null, null, position, destinationId, destination, null, null);
|
||||
final Departure dep = new Departure(plannedTime.getTime(), predictedTime != null ? predictedTime.getTime() : null, new Line(
|
||||
null, line, line != null ? lineColors(line) : null), position, destinationId, destination, null, null);
|
||||
|
||||
if (!departures.contains(dep))
|
||||
departures.add(dep);
|
||||
|
|
|
@ -26,23 +26,19 @@ public final class Departure
|
|||
{
|
||||
final public Date plannedTime;
|
||||
final public Date predictedTime;
|
||||
final public String line;
|
||||
final public int[] lineColors;
|
||||
final public String lineLink;
|
||||
final public Line line;
|
||||
final public String position;
|
||||
final public int destinationId;
|
||||
final public String destination;
|
||||
final public int[] capacity;
|
||||
final public String message;
|
||||
|
||||
public Departure(final Date plannedTime, final Date predictedTime, final String line, final int[] lineColors, final String lineLink,
|
||||
final String position, final int destinationId, final String destination, final int[] capacity, final String message)
|
||||
public Departure(final Date plannedTime, final Date predictedTime, final Line line, final String position, final int destinationId,
|
||||
final String destination, final int[] capacity, final String message)
|
||||
{
|
||||
this.plannedTime = plannedTime;
|
||||
this.predictedTime = predictedTime;
|
||||
this.line = line;
|
||||
this.lineColors = lineColors;
|
||||
this.lineLink = lineLink;
|
||||
this.position = position;
|
||||
this.destinationId = destinationId;
|
||||
this.destination = destination;
|
||||
|
@ -50,21 +46,6 @@ public final class Departure
|
|||
this.message = message;
|
||||
}
|
||||
|
||||
public Departure(final Date plannedTime, final String line, final int[] lineColors, final String position, final int destinationId,
|
||||
final String destination)
|
||||
{
|
||||
this.plannedTime = plannedTime;
|
||||
this.predictedTime = null;
|
||||
this.line = line;
|
||||
this.lineColors = lineColors;
|
||||
this.lineLink = null;
|
||||
this.position = position;
|
||||
this.destinationId = destinationId;
|
||||
this.destination = destination;
|
||||
this.capacity = null;
|
||||
this.message = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
|
|
@ -24,11 +24,15 @@ import java.io.Serializable;
|
|||
*/
|
||||
public final class Line implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = -5642533805998375070L;
|
||||
|
||||
final public String id;
|
||||
final public String label;
|
||||
final public int[] colors;
|
||||
|
||||
public Line(final String label, final int[] colors)
|
||||
public Line(final String id, final String label, final int[] colors)
|
||||
{
|
||||
this.id = id;
|
||||
this.label = label;
|
||||
this.colors = colors;
|
||||
}
|
||||
|
|
|
@ -22,15 +22,13 @@ package de.schildbach.pte.dto;
|
|||
*/
|
||||
public final class LineDestination
|
||||
{
|
||||
final public String line;
|
||||
final public int[] lineColors;
|
||||
final public Line line;
|
||||
final public int destinationId;
|
||||
final public String destination;
|
||||
|
||||
public LineDestination(final String line, final int[] lineColors, final int destinationId, final String destination)
|
||||
public LineDestination(final Line line, final int destinationId, final String destination)
|
||||
{
|
||||
this.line = line;
|
||||
this.lineColors = lineColors;
|
||||
this.destinationId = destinationId;
|
||||
this.destination = destination;
|
||||
}
|
||||
|
@ -38,7 +36,7 @@ public final class LineDestination
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder("Line(");
|
||||
StringBuilder builder = new StringBuilder("LineDestination(");
|
||||
builder.append(line != null ? line : "null");
|
||||
builder.append(",");
|
||||
builder.append(destinationId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue