[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Space.java, 1.226, 1.227 Container.j
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-12-13 12:40:03
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4271/src/net/sourceforge/bprocessor/model Modified Files: Space.java Container.java Log Message: moved actual fields down to container Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.226 retrieving revision 1.227 diff -C2 -d -r1.226 -r1.227 *** Space.java 13 Dec 2007 12:28:57 -0000 1.226 --- Space.java 13 Dec 2007 12:39:36 -0000 1.227 *************** *** 16,20 **** import java.util.List; import java.util.Set; - import java.util.Map; import net.sourceforge.bprocessor.model.modellor.Modellor; --- 16,19 ---- *************** *** 78,106 **** protected Container empty; - /** The elements (a list of spaces) */ - protected HashMap<Long, Space> elements; - - /** The next element id */ - protected long nextElementId; - - /** The vertices */ - protected HashMap<Long, Vertex> vertices; - /** The next vertex id */ - protected long nextVertexId; - - /** The edges */ - protected HashMap<Long, Edge> edges; - /** The next edge id */ - protected long nextEdgeId; - - /** The surfaces */ - protected HashMap<Long, Surface> surfaces; - /** The next surface id */ - protected long nextSurfaceId; - - /** The constructors */ - protected Map<Long, Constructor> constructors; - /** The next constructor id */ - protected long nextConstructorId; /** The modellor */ --- 77,80 ---- *************** *** 110,117 **** - - - - /** * Constructor for persistence layer --- 84,87 ---- *************** *** 120,141 **** super(); envelope = new HashSet<Surface>(); - initializeContainers(); } ! /** ! * Initialize the data structures ! */ ! private void initializeContainers() { ! vertices = new HashMap<Long, Vertex>(); ! nextVertexId = 1; ! edges = new HashMap<Long, Edge>(); ! nextEdgeId = 1; ! surfaces = new HashMap<Long, Surface>(); ! nextSurfaceId = 1; ! elements = new HashMap<Long, Space>(); ! nextElementId = 1; ! constructors = new HashMap<Long, Constructor>(); ! nextConstructorId = 1; ! } /** --- 90,96 ---- super(); envelope = new HashSet<Surface>(); } ! /** *************** *** 157,165 **** description = new Description(""); envelope = new HashSet<Surface>(); - if (container) { - initializeContainers(); - empty = new Container("Void", FUNCTIONAL, false); - ((Container) this).add(empty); - } } --- 112,115 ---- *************** *** 411,454 **** /** - * Set the vertices - * @param vertices HashMap - */ - public void setVertices(HashMap<Long, Vertex> vertices) { - this.vertices = vertices; - nextVertexId = Entity.maxId(vertices.values()) + 1; - } - - /** - * Set the edges - * @param edges HashMap - */ - public void setEdges(HashMap<Long, Edge> edges) { - this.edges = edges; - nextEdgeId = Entity.maxId(edges.values()) + 1; - } - - /** - * Set the surfaces - * @param surfaces HashMap - */ - public void setSurfaces(HashMap<Long, Surface> surfaces) { - this.surfaces = surfaces; - nextSurfaceId = Entity.maxId(surfaces.values()) + 1; - } - - - - /** - * Compute next id - * - */ - public void computeNextId() { - nextVertexId = Entity.maxId(vertices.values()) + 1; - nextEdgeId = Entity.maxId(edges.values()) + 1; - nextSurfaceId = Entity.maxId(surfaces.values()) + 1; - nextElementId = Entity.maxId(elements.values()) + 1; - } - - /** * Add a surface to the envelope * @param surface The surface --- 361,364 ---- *************** *** 465,473 **** envelope.remove(surface); } - - - - - /** --- 375,378 ---- *************** *** 739,761 **** public Set<Vertex> collectInterior() { Set<Vertex> result = new HashSet<Vertex>(); - Iterator it; - if (container) { - it = elements.values().iterator(); - while (it.hasNext()) { - result.addAll(((Geometric)it.next()).collect()); - } - it = surfaces.values().iterator(); - while (it.hasNext()) { - result.addAll(((Geometric)it.next()).collect()); - } - it = edges.values().iterator(); - while (it.hasNext()) { - result.addAll(((Geometric)it.next()).collect()); - } - it = vertices.values().iterator(); - while (it.hasNext()) { - result.addAll(((Geometric)it.next()).collect()); - } - } return result; } --- 644,647 ---- Index: Container.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Container.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Container.java 13 Dec 2007 12:28:57 -0000 1.5 --- Container.java 13 Dec 2007 12:39:36 -0000 1.6 *************** *** 24,27 **** --- 24,55 ---- */ public class Container extends Space { + + /** The elements (a list of spaces) */ + protected HashMap<Long, Space> elements; + + /** The next element id */ + protected long nextElementId; + + /** The vertices */ + protected HashMap<Long, Vertex> vertices; + /** The next vertex id */ + protected long nextVertexId; + + /** The edges */ + protected HashMap<Long, Edge> edges; + /** The next edge id */ + protected long nextEdgeId; + + /** The surfaces */ + protected HashMap<Long, Surface> surfaces; + /** The next surface id */ + protected long nextSurfaceId; + + /** The constructors */ + protected Map<Long, Constructor> constructors; + /** The next constructor id */ + protected long nextConstructorId; + + /** * Empty constructor *************** *** 29,32 **** --- 57,62 ---- */ public Container() { + super(); + initializeContainers(); } *************** *** 39,42 **** --- 69,93 ---- public Container(String name, int type, boolean container) { super(name, type, container); + if (container) { + initializeContainers(); + empty = new Container("Void", FUNCTIONAL, false); + ((Container) this).add(empty); + } + } + + /** + * Initialize the data structures + */ + private void initializeContainers() { + vertices = new HashMap<Long, Vertex>(); + nextVertexId = 1; + edges = new HashMap<Long, Edge>(); + nextEdgeId = 1; + surfaces = new HashMap<Long, Surface>(); + nextSurfaceId = 1; + elements = new HashMap<Long, Space>(); + nextElementId = 1; + constructors = new HashMap<Long, Constructor>(); + nextConstructorId = 1; } *************** *** 1289,1291 **** --- 1340,1408 ---- Project.getInstance().changed(Project.getInstance()); } + + /** + * + * @return the interior set of vertices + */ + public Set<Vertex> collectInterior() { + Set<Vertex> result = new HashSet<Vertex>(); + Iterator it; + if (container) { + it = elements.values().iterator(); + while (it.hasNext()) { + result.addAll(((Geometric)it.next()).collect()); + } + it = surfaces.values().iterator(); + while (it.hasNext()) { + result.addAll(((Geometric)it.next()).collect()); + } + it = edges.values().iterator(); + while (it.hasNext()) { + result.addAll(((Geometric)it.next()).collect()); + } + it = vertices.values().iterator(); + while (it.hasNext()) { + result.addAll(((Geometric)it.next()).collect()); + } + } + return result; + } + + /** + * Compute next id + * + */ + public void computeNextId() { + nextVertexId = Entity.maxId(vertices.values()) + 1; + nextEdgeId = Entity.maxId(edges.values()) + 1; + nextSurfaceId = Entity.maxId(surfaces.values()) + 1; + nextElementId = Entity.maxId(elements.values()) + 1; + } + + /** + * Set the vertices + * @param vertices HashMap + */ + public void setVertices(HashMap<Long, Vertex> vertices) { + this.vertices = vertices; + nextVertexId = Entity.maxId(vertices.values()) + 1; + } + + /** + * Set the edges + * @param edges HashMap + */ + public void setEdges(HashMap<Long, Edge> edges) { + this.edges = edges; + nextEdgeId = Entity.maxId(edges.values()) + 1; + } + + /** + * Set the surfaces + * @param surfaces HashMap + */ + public void setSurfaces(HashMap<Long, Surface> surfaces) { + this.surfaces = surfaces; + nextSurfaceId = Entity.maxId(surfaces.values()) + 1; + } } |