[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Mesh.java,1.1,1.2
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2006-01-24 09:42:02
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32482/src/net/sourceforge/bprocessor/model Modified Files: Mesh.java Log Message: More work on the Mesh Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Mesh.java 23 Jan 2006 10:16:32 -0000 1.1 --- Mesh.java 24 Jan 2006 09:41:54 -0000 1.2 *************** *** 21,24 **** --- 21,36 ---- private long nextVertexId; + /** The edges */ + private HashMap edges; + + /** The next edge id */ + private long nextEdgeId; + + /** The surfaces */ + private HashMap surfaces; + + /** The next surface id */ + private long nextSurfaceId; + /** * Constructor for Mesh *************** *** 27,30 **** --- 39,44 ---- super(); vertices = new HashMap(); + edges = new HashMap(); + surfaces = new HashMap(); } *************** *** 83,86 **** --- 97,208 ---- return (Vertex) vertices.get(new Long(id)); } + + /** + * Add a edge + * @param edge The edge + */ + public void add(Edge edge) { + Long id = new Long(nextEdgeId++); + edge.setId(id); + edges.put(id, edge); + } + + /** + * Remove a edge + * @param edge The edge + */ + public void remove(Edge edge) { + edges.remove(edge.getId()); + edge.setId(null); + } + + /** + * Insert a edge + * @param edge The edge + * @return The edge + */ + public Edge insert(Edge edge) { + add(edge); + return edge; + } + + /** + * Delete a edge + * @param edge The edge + */ + public void delete(Edge edge) { + remove(edge); + } + + /** + * Return the edges + * @return The edges + */ + public Collection getEdges() { + return edges.values(); + } + + /** + * Return the edge + * @param id The id + * @return The edge + */ + public Edge getEdge(long id) { + return (Edge) edges.get(new Long(id)); + } + + /** + * Add a surface + * @param surface The surface + */ + public void add(Surface surface) { + Long id = new Long(nextSurfaceId++); + surface.setId(id); + surfaces.put(id, surface); + } + + /** + * Remove a surface + * @param surface The surface + */ + public void remove(Surface surface) { + surfaces.remove(surface.getId()); + surface.setId(null); + } + + /** + * Insert a surface + * @param surface The surface + * @return The surface + */ + public Surface insert(Surface surface) { + add(surface); + return surface; + } + + /** + * Delete a surface + * @param surface The surface + */ + public void delete(Surface surface) { + remove(surface); + } + + /** + * Return the surfaces + * @return The surfaces + */ + public Collection getSurfaces() { + return surfaces.values(); + } + + /** + * Return the surface + * @param id The id + * @return The surface + */ + public Surface getSurface(long id) { + return (Surface) surfaces.get(new Long(id)); + } } |