mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-15 17:10:30 +00:00
List products used by a trip.
This commit is contained in:
parent
82674cef74
commit
599029b261
1 changed files with 21 additions and 0 deletions
|
@ -20,6 +20,7 @@ package de.schildbach.pte.dto;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@ -109,6 +110,26 @@ public final class Trip implements Serializable
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Product> products()
|
||||||
|
{
|
||||||
|
final List<Product> products = new LinkedList<Product>();
|
||||||
|
|
||||||
|
if (legs != null)
|
||||||
|
{
|
||||||
|
for (final Leg leg : legs)
|
||||||
|
{
|
||||||
|
if (leg instanceof Public)
|
||||||
|
{
|
||||||
|
final Product product = Product.fromCode(((Public) leg).line.label.charAt(0));
|
||||||
|
if (!products.contains(product))
|
||||||
|
products.add(product);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return products;
|
||||||
|
}
|
||||||
|
|
||||||
public String getId()
|
public String getId()
|
||||||
{
|
{
|
||||||
if (id == null)
|
if (id == null)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue