diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Route.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Route.java index c54bd456..12fc4dcd 100644 --- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Route.java +++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/object/Route.java @@ -18,9 +18,9 @@ package edu.usf.cutr.go_sync.object; import edu.usf.cutr.go_sync.tag_defs; -import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; +import java.util.LinkedHashSet; /** * @@ -29,11 +29,11 @@ public class Route extends OsmPrimitive implements Comparable{ private String routeId, routeRef, operatorName; - private HashSet osmMembers; + private LinkedHashSet osmMembers; public Route(String rId, String rRef, String op) { osmTags = new Hashtable(); - osmMembers = new HashSet(); + osmMembers = new LinkedHashSet (); routeId = rId; if(rId!=null) this.osmTags.put(tag_defs.OSM_ROUTE_ID_KEY, rId); routeRef = rRef; @@ -43,7 +43,7 @@ public Route(String rId, String rRef, String op) { public Route(Route r) { this.osmTags = new Hashtable(); if(r.osmTags!=null) this.osmTags.putAll(r.osmTags); - this.osmMembers = new HashSet(); + this.osmMembers = new LinkedHashSet (); if(r.getOsmMembers()!=null) this.osmMembers.addAll(r.getOsmMembers()); this.routeId = r.getRouteId(); String ori = (String)r.getTags().get(tag_defs.OSM_ROUTE_ID_KEY); @@ -63,7 +63,7 @@ public void addOsmMember(RelationMember osmNodeId){ osmMembers.add(osmNodeId); } - public void addOsmMembers(HashSet oMembers){ + public void addOsmMembers(LinkedHashSet oMembers){ osmMembers.addAll(oMembers); } @@ -84,7 +84,7 @@ public RelationMember getOsmMember(String ref) { return null; } - public HashSet getOsmMembers(){ + public LinkedHashSet getOsmMembers(){ return osmMembers; } @@ -136,4 +136,4 @@ public int hashCode(){ public String toString(){ return this.getRouteId(); } -} \ No newline at end of file +} diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/osm/HttpRequest.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/osm/HttpRequest.java index 37a5bb7b..2e0f0202 100644 --- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/osm/HttpRequest.java +++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/osm/HttpRequest.java @@ -22,6 +22,7 @@ import java.util.HashSet; import java.util.Hashtable; +import java.util.LinkedHashSet; import java.util.List; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; @@ -67,7 +68,7 @@ public class HttpRequest { private ArrayList existingRelations = new ArrayList(); private ArrayList existingBusTags = new ArrayList(); private ArrayList existingRelationTags = new ArrayList(); - private ArrayList> existingRelationMembers = new ArrayList>(); + private ArrayList> existingRelationMembers = new ArrayList>(); private HashSet revertDelete = new HashSet(); private HashSet revertModify = new HashSet(); @@ -225,7 +226,7 @@ public ArrayList getExistingBusRelationTags(){ } // this method needs to be invoked after getExistingBusRelations - public ArrayList> getExistingBusRelationMembers(){ + public ArrayList> getExistingBusRelationMembers(){ System.out.println("tags = "+existingRelationMembers.size()); if (!existingRelationMembers.isEmpty() ) return existingRelationMembers; diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/task/CompareData.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/task/CompareData.java index dbaeb964..d0c8704b 100644 --- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/task/CompareData.java +++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/task/CompareData.java @@ -26,6 +26,7 @@ import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.List; import java.util.Comparator; import java.util.SortedSet; @@ -78,7 +79,7 @@ public class CompareData extends OsmTask{ private ArrayList OSMRelations = new ArrayList(); // private ArrayList> OSMRelationTags = new ArrayList>(); private ArrayList OSMRelationTags = new ArrayList(); - private ArrayList> OSMRelationMembers = new ArrayList>(); + private ArrayList> OSMRelationMembers = new ArrayList>(); // key is gtfs, value is container of potential osm matches, sorted by distance from gtfs stop private Hashtable> report = new Hashtable>(); @@ -564,7 +565,7 @@ public void compareRouteData() throws InterruptedException{ ) ) { // System.out.println(routeId +"\t" + operator); - HashSet em = OSMRelationMembers.get(osm); + LinkedHashSet em = OSMRelationMembers.get(osm); Route r; String ostring,idstring,refstring; diff --git a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/tools/parser/RouteParser.java b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/tools/parser/RouteParser.java index f28fe2d3..123af6cd 100644 --- a/GO_Sync/src/main/java/edu/usf/cutr/go_sync/tools/parser/RouteParser.java +++ b/GO_Sync/src/main/java/edu/usf/cutr/go_sync/tools/parser/RouteParser.java @@ -18,9 +18,9 @@ package edu.usf.cutr.go_sync.tools.parser; import java.util.ArrayList; -import java.util.HashSet; import java.util.Hashtable; import edu.usf.cutr.go_sync.object.RelationMember; +import java.util.LinkedHashSet; import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.Attributes; import org.xml.sax.SAXException; @@ -32,22 +32,22 @@ */ public class RouteParser extends DefaultHandler { private Hashtable tempTag; - private HashSet tempMembers; + private LinkedHashSet tempMembers; private ArrayList xmlRelations; //xmlTags ----------- xmlMembers private ArrayList xmlTags; - private ArrayList> xmlMembers; + private ArrayList> xmlMembers; public RouteParser(){ xmlRelations = new ArrayList(); xmlTags = new ArrayList(); - xmlMembers = new ArrayList>(); + xmlMembers = new ArrayList>(); } @Override public void startElement(String namespaceURI, String localName, String qname, Attributes attributes) throws SAXException { if (qname.equals("relation")) { AttributesImpl attImpl = new AttributesImpl(attributes); xmlRelations.add(attImpl); tempTag = new Hashtable(); // start to collect tags of that relation - tempMembers = new HashSet(); + tempMembers = new LinkedHashSet(); } if (tempTag!=null && qname.equals("tag")) { AttributesImpl attImpl = new AttributesImpl(attributes); @@ -78,7 +78,7 @@ public ArrayList getTags(){ return xmlTags; } - public ArrayList> getMembers(){ + public ArrayList> getMembers(){ return xmlMembers; } } \ No newline at end of file