fix line colors

git-svn-id: https://public-transport-enabler.googlecode.com/svn/trunk@42 0924bc21-9374-b0fa-ee44-9ff1593b38f0
This commit is contained in:
andreas.schildbach 2010-08-06 14:28:07 +00:00
parent 51f6d38d57
commit 6af2a24deb
6 changed files with 41 additions and 6 deletions

View file

@ -747,7 +747,7 @@ public final class BahnProvider implements NetworkProvider
throw new IllegalStateException("cannot normalize line " + line);
}
public static final Map<Character, int[]> LINES = new HashMap<Character, int[]>();
private static final Map<Character, int[]> LINES = new HashMap<Character, int[]>();
static
{
@ -759,4 +759,9 @@ public final class BahnProvider implements NetworkProvider
LINES.put('B', new int[] { Color.parseColor("#993399"), Color.WHITE });
LINES.put('F', new int[] { Color.BLUE, Color.WHITE });
}
public int[] lineColors(final String line)
{
return LINES.get(line.charAt(0));
}
}

View file

@ -680,7 +680,7 @@ public class MvvProvider implements NetworkProvider
throw new IllegalArgumentException("cannot parse month: " + month);
}
public static final Map<String, int[]> LINES = new HashMap<String, int[]>();
private static final Map<String, int[]> LINES = new HashMap<String, int[]>();
static
{
@ -724,4 +724,9 @@ public class MvvProvider implements NetworkProvider
LINES.put("UU5", new int[] { Color.parseColor("#bb7700"), Color.WHITE });
LINES.put("UU6", new int[] { Color.parseColor("#0000cc"), Color.WHITE });
}
public int[] lineColors(final String line)
{
return LINES.get(line);
}
}

View file

@ -130,4 +130,13 @@ public interface NetworkProvider
* @throws IOException
*/
QueryDeparturesResult queryDepartures(String queryUri) throws IOException;
/**
* Get colors of line
*
* @param line
* line to get color of
* @return array containing background, foreground and border (optional) colors
*/
int[] lineColors(String line);
}

View file

@ -160,7 +160,8 @@ public class RmvProvider implements NetworkProvider
private static final Pattern P_CHECK_CONNECTIONS_ERROR = Pattern.compile(
"(?:(mehrfach vorhanden oder identisch)|(keine Verbindung gefunden werden))", Pattern.CASE_INSENSITIVE);
public CheckConnectionsQueryResult checkConnectionsQuery(final String from, final String via, final String to, final Date date, final boolean dep) throws IOException
public CheckConnectionsQueryResult checkConnectionsQuery(final String from, final String via, final String to, final Date date, final boolean dep)
throws IOException
{
final String queryUri = connectionsQueryUri(from, via, to, date, dep);
final CharSequence page = ParserUtils.scrape(queryUri);
@ -534,7 +535,7 @@ public class RmvProvider implements NetworkProvider
throw new IllegalStateException("cannot normalize line " + line);
}
public static final Map<Character, int[]> LINES = new HashMap<Character, int[]>();
private static final Map<Character, int[]> LINES = new HashMap<Character, int[]>();
static
{
@ -546,4 +547,9 @@ public class RmvProvider implements NetworkProvider
LINES.put('B', new int[] { Color.parseColor("#993399"), Color.WHITE });
LINES.put('F', new int[] { Color.BLUE, Color.WHITE });
}
public int[] lineColors(final String line)
{
return LINES.get(line.charAt(0));
}
}

View file

@ -333,7 +333,7 @@ public class SbbProvider implements NetworkProvider
throw new IllegalStateException("cannot normalize line " + line);
}
public static final Map<Character, int[]> LINES = new HashMap<Character, int[]>();
private static final Map<Character, int[]> LINES = new HashMap<Character, int[]>();
static
{
@ -345,4 +345,9 @@ public class SbbProvider implements NetworkProvider
LINES.put('B', new int[] { Color.parseColor("#993399"), Color.WHITE });
LINES.put('F', new int[] { Color.BLUE, Color.WHITE });
}
public int[] lineColors(final String line)
{
return LINES.get(line.charAt(0));
}
}

View file

@ -555,7 +555,7 @@ public final class VbbProvider implements NetworkProvider
throw new IllegalStateException("cannot normalize line " + line);
}
public static final Map<String, int[]> LINES = new HashMap<String, int[]>();
private static final Map<String, int[]> LINES = new HashMap<String, int[]>();
static
{
@ -670,4 +670,9 @@ public final class VbbProvider implements NetworkProvider
LINES.put("RRB91", new int[] { Color.parseColor("#A7653F"), Color.WHITE });
LINES.put("RRB93", new int[] { Color.parseColor("#A7653F"), Color.WHITE });
}
public int[] lineColors(final String line)
{
return LINES.get(line);
}
}