1 |
|
package net.jaekl.frank.octranspo; |
2 |
|
|
3 |
|
import java.util.ArrayList; |
4 |
|
|
5 |
|
import net.jaekl.qd.xml.ParseResult; |
6 |
|
import net.jaekl.qd.xml.XmlParseException; |
7 |
|
|
8 |
Block: 1/1 |
public class StopInfo extends ParseResult |
9 |
|
{ |
10 |
|
|
11 |
Block: 1/1 |
public static String STOP_NO = "StopNo"; |
12 |
|
public static String DESCRIPTION = "StopDescription"; |
13 |
|
public static String STOP_LABEL = "StopLabel"; |
14 |
|
public static String ERROR = "Error"; |
15 |
|
public static String ROUTES = "Routes"; |
16 |
|
public static String ROUTE = "Route"; |
17 |
|
|
18 |
|
|
19 |
|
int m_stopNo; |
20 |
|
String m_descr; |
21 |
|
String m_error; |
22 |
|
ArrayList<Route> m_routes; |
23 |
|
|
24 |
|
|
25 |
|
public StopInfo(String rootTagName, String[] internal, Object[][] external) { |
26 |
Block: 1/1 |
super(rootTagName, internal, external); |
27 |
|
|
28 |
|
m_stopNo = 0; |
29 |
|
m_descr = ""; |
30 |
|
m_error = ""; |
31 |
|
m_routes = new ArrayList<Route>(); |
32 |
|
} |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
Block: 1/1 |
public int getStopNo() { return m_stopNo; } |
38 |
Block: 1/1 |
public String getDescr() { return m_descr; } |
39 |
Block: 1/1 |
public String getError() { return m_error; } |
40 |
Block: 1/1 |
public int getNumRoutes() { return m_routes.size(); } |
41 |
Block: 1/1 |
public Route getRoute(int idx) { return m_routes.get(idx); } |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
@Override |
47 |
|
public void endContents(String uri, String localName, String qName, String chars) throws XmlParseException |
48 |
|
{ |
49 |
Block: 1/1 |
assert (null != localName); |
50 |
|
|
51 |
Block: 1/1 Branch: 1/2 |
if (localName.equals(STOP_NO)) { |
52 |
Block: 1/1 Branch: 1/1 |
m_stopNo = Integer.parseInt(chars); |
53 |
|
} |
54 |
Block: 1/1 Branch: 1/1 |
else if (localName.equals(DESCRIPTION) || localName.equals(STOP_LABEL)) { |
55 |
Block: 1/1 Branch: 2/2 |
m_descr = chars; |
56 |
|
} |
57 |
Block: 1/1 Branch: 1/1 |
else if (localName.equals(ERROR)) { |
58 |
Block: 1/1 Branch: 1/1 |
m_error = chars; |
59 |
|
} |
60 |
Block: 1/1 Branch: 1/1 |
} |
61 |
|
|
62 |
|
@Override |
63 |
|
public void endExternal(String uri, String localName, String qName) throws XmlParseException |
64 |
|
{ |
65 |
Block: 1/1 |
if (localName.equals(ROUTE)) { |
66 |
Block: 1/1 Branch: 1/1 |
ParseResult[] collected = collectParsedChildren(Route.class); |
67 |
|
for (ParseResult pr : collected) { |
68 |
Block: 1/1 Branch: 1/1 |
assert (pr instanceof Route); |
69 |
Block: 1/1 Branch: 1/2 |
m_routes.add((Route)pr); |
70 |
|
} |
71 |
|
} |
72 |
Block: 1/1 Branch: 1/2 |
} |
73 |
|
|
74 |
|
|
75 |
|
} |
76 |
|
|