[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Line.java, 1.1, 1.2 Space.java, 1.38
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-07-04 11:53:45
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21437/src/net/sourceforge/bprocessor/model Modified Files: Line.java Space.java Point.java Constructor.java Log Message: fixed checkstyle problem and added add remove of constructors to Space Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Space.java 26 Jun 2006 11:36:26 -0000 1.38 --- Space.java 4 Jul 2006 11:53:43 -0000 1.39 *************** *** 82,85 **** --- 82,90 ---- private long nextSurfaceId; + /** The co0nstructors */ + private HashMap constructors; + /** The next constructor id */ + private long nextConstructorId; + /** The materials */ private HashMap materials; *************** *** 99,104 **** {"None", "Exterior", "Livingroom", "Bathroom", "Bedroom"}; - - /** The modellor */ private Modellor modellor; --- 104,107 ---- *************** *** 133,136 **** --- 136,140 ---- elements = new HashMap(); materials = new HashMap(); + constructors = new HashMap(); empty = new Space("Void", FUNCTIONAL, false); this.add(empty); *************** *** 259,262 **** --- 263,268 ---- elements.clear(); nextElementId = 0; + constructors.clear(); + nextConstructorId = 0; empty = new Space("Void", FUNCTIONAL, false); this.add(empty); *************** *** 265,268 **** --- 271,337 ---- /** + * Add a constructor + * @param c The constructor element + */ + public void add(Constructor c) { + if (container) { + Long id; + if (c.getId() != null) { + id = c.getId(); + nextConstructorId = Math.max(nextConstructorId, id.longValue() + 1); + } else { + id = new Long(nextConstructorId++); + c.setId(id); + } + constructors.put(id, c); + c.setOwner(this); + } else { + throw new Error("adding constructor to non-container " + this); + } + } + + /** + * Remove a constructor + * @param c The constructor element + */ + public void remove(Constructor c) { + constructors.remove(c.getId()); + c.setId(null); + c.setOwner(null); + } + + /** + * Insert a constructor + * @param c The constructor + * @return The constructor + */ + public Constructor insert(Constructor c) { + add(c); + return c; + } + + /** + * Delete a constructor + * @param c The constructor + */ + public void delete(Constructor c) { + if (c.getId() != null) { + remove(c); + } + } + + /** + * Return the constructors + * @return The constructors + */ + public Collection getConstructors() { + if (container) { + return constructors.values(); + } else { + return EMPTY; + } + } + + /** * Add a vertex * @param vertex The vertex |