[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Space.java, 1.196, 1.197 Project.jav
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-11-05 10:18:49
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv8014/src/net/sourceforge/bprocessor/model Modified Files: Space.java Project.java Log Message: simplification of level Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.196 retrieving revision 1.197 diff -C2 -d -r1.196 -r1.197 *** Space.java 5 Nov 2007 09:45:05 -0000 1.196 --- Space.java 5 Nov 2007 10:18:50 -0000 1.197 *************** *** 41,51 **** public static final int FUNCTIONAL = 1; /** project level */ ! public static final int PROJECT_LEVEL = 2; /** Space level */ ! public static final int SPACE_LEVEL = 3; /** Element level */ ! public static final int ELEMENT_LEVEL = 4; /** part level */ ! public static final int PART_LEVEL = 5; /** union flag */ --- 41,51 ---- public static final int FUNCTIONAL = 1; /** project level */ ! public static final int PROJECT_LEVEL = 0; /** Space level */ ! public static final int SPACE_LEVEL = 1; /** Element level */ ! public static final int ELEMENT_LEVEL = 2; /** part level */ ! public static final int PART_LEVEL = 3; /** union flag */ *************** *** 65,71 **** private int type; - /** level Space element or part */ - private int level; - /** Tell if the space is finished and therefore cannot be edited */ private boolean locked = false; --- 65,68 ---- *************** *** 179,183 **** */ public static Space createNet(String name) { ! Space net = new Space(name, Space.FUNCTIONAL, 0, true); net.setNet(true); return net; --- 176,180 ---- */ public static Space createNet(String name) { ! Space net = new Space(name, Space.FUNCTIONAL, true); net.setNet(true); return net; *************** *** 215,226 **** * @param name The name * @param type The type - * @param level The level * @param container The container flag */ ! public Space(String name, int type, int level, boolean container) { super(); setName(name); setType(type); - this.level = level; if (type == FUNCTIONAL) { setTransparent(true); --- 212,221 ---- * @param name The name * @param type The type * @param container The container flag */ ! public Space(String name, int type, boolean container) { super(); setName(name); setType(type); if (type == FUNCTIONAL) { setTransparent(true); *************** *** 235,239 **** if (container) { initializeContainers(); ! empty = new Space("Void", FUNCTIONAL, level + 1, false); this.add(empty); } --- 230,234 ---- if (container) { initializeContainers(); ! empty = new Space("Void", FUNCTIONAL, false); this.add(empty); } *************** *** 248,253 **** */ public Space createConstructionSpace(String name) { ! int lvl = this.level + 1; ! return new Space(name, Space.CONSTRUCTION, lvl, true); } --- 243,247 ---- */ public Space createConstructionSpace(String name) { ! return new Space(name, Space.CONSTRUCTION, true); } *************** *** 261,265 **** s.add(new CoordinateSystem(new Vertex(0, 0, 0))); s.setUnion(true); - s.setLevel(level); return s; } --- 255,258 ---- *************** *** 284,292 **** */ public Space createFunctionalSpace(String name) { ! int lvl = this.level + 1; ! if (isUnion()) { ! lvl--; ! } ! return new Space(name, Space.FUNCTIONAL, lvl, false); } --- 277,281 ---- */ public Space createFunctionalSpace(String name) { ! return new Space(name, Space.FUNCTIONAL, false); } *************** *** 1398,1402 **** break; } ! int lvl = level - (isUnion() ? 1 : 0); return res.concat(Space.levelToString(lvl)); } --- 1387,1391 ---- break; } ! int lvl = getLevel(); return res.concat(Space.levelToString(lvl)); } *************** *** 1409,1416 **** public String getLevelName() { String res; ! int lvl = level; ! if (isUnion()) { ! lvl++; ! } switch (lvl) { case ELEMENT_LEVEL: --- 1398,1402 ---- public String getLevelName() { String res; ! int lvl = getLevel(); switch (lvl) { case ELEMENT_LEVEL: *************** *** 1584,1588 **** copy.container = container; copy.description = description; - copy.level = level; copy.name = name; return copy; --- 1570,1573 ---- *************** *** 1616,1620 **** Space copy = new Space("", this.getType(), - this.getLevel(), this.isContainer()); copy.setName(this.getName()); --- 1601,1604 ---- *************** *** 2446,2449 **** --- 2430,2440 ---- */ public int getLevel() { + int level = 0; + if (getOwner() != null) { + level = getOwner().getLevel(); + if (!isUnion()) { + level++; + } + } return level; } *************** *** 2462,2466 **** */ protected void setLevel(int level) { - this.level = level; } --- 2453,2456 ---- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** Project.java 22 Oct 2007 06:55:09 -0000 1.136 --- Project.java 5 Nov 2007 10:18:50 -0000 1.137 *************** *** 156,160 **** staticObservers = new LinkedList(); scheduledObservers = new LinkedList(); ! world = new Space("World", Space.FUNCTIONAL, Space.PROJECT_LEVEL, true); world.setId(new Long(0)); materials = new HashMap<Long, Material>(); --- 156,160 ---- staticObservers = new LinkedList(); scheduledObservers = new LinkedList(); ! world = new Space("World", Space.FUNCTIONAL, true); world.setId(new Long(0)); materials = new HashMap<Long, Material>(); |