[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model SurfaceAnalysis.java, 1.10, 1.11 Spa
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-08-27 14:25:15
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21325/src/net/sourceforge/bprocessor/model Modified Files: SurfaceAnalysis.java Space.java Log Message: Space.getEdgeMap returns an edge-map Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.169 retrieving revision 1.170 diff -C2 -d -r1.169 -r1.170 *** Space.java 23 Aug 2007 14:24:45 -0000 1.169 --- Space.java 27 Aug 2007 13:39:01 -0000 1.170 *************** *** 145,148 **** --- 145,170 ---- /** + * Returns a map from the vertices in the specified collection + * to the edges sharing the vertex. + * @param vertices Collection a vertices + * @return Map from the specified vertices the the adjacent edges + */ + public Map<Vertex, List<Edge>> getEdgeMap(Collection<Vertex> vertices) { + Map<Vertex, List<Edge>> edgemap = new HashMap(); + for (Vertex current : vertices) { + edgemap.put(current, new LinkedList()); + } + for (Edge current : getEdges()) { + Vertex from = current.getFrom(); + List<Edge> fl = edgemap.get(from); + fl.add(current); + Vertex to = current.getTo(); + List<Edge> tl = edgemap.get(to); + tl.add(current); + } + return edgemap; + } + + /** * Constructor for persistence layer */ Index: SurfaceAnalysis.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceAnalysis.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SurfaceAnalysis.java 26 Jul 2007 09:52:32 -0000 1.10 --- SurfaceAnalysis.java 27 Aug 2007 13:39:01 -0000 1.11 *************** *** 91,106 **** { Collection<Vertex> vertices = space.getVertices(); ! Map<Vertex, List<Edge>> edgemap = new HashMap(); ! for (Vertex current : vertices) { ! edgemap.put(current, new LinkedList()); ! } ! for (Edge current : edges) { ! Vertex from = current.getFrom(); ! List<Edge> fl = edgemap.get(from); ! fl.add(current); ! Vertex to = current.getTo(); ! List<Edge> tl = edgemap.get(to); ! tl.add(current); ! } for (Edge current : edges) { List<Edge> incident = new LinkedList(); --- 91,97 ---- { Collection<Vertex> vertices = space.getVertices(); ! ! Map<Vertex, List<Edge>> edgemap = space.getEdgeMap(vertices); ! for (Edge current : edges) { List<Edge> incident = new LinkedList(); |