[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Instance.java, 1.2, 1.3 Space.java,
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2007-12-12 14:38:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28483/src/net/sourceforge/bprocessor/model Modified Files: Instance.java Space.java Persistence.java Container.java Log Message: Moved proto and anchor to instance Index: Instance.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Instance.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Instance.java 12 Dec 2007 12:02:21 -0000 1.2 --- Instance.java 12 Dec 2007 14:38:43 -0000 1.3 *************** *** 8,11 **** --- 8,14 ---- package net.sourceforge.bprocessor.model; + import java.util.HashSet; + import java.util.Set; + /** * *************** *** 13,16 **** --- 16,29 ---- public class Instance extends Space { /** + * If proto points to another space, this space + * is an instance of the other space and is not + * a container. + */ + private Space proto; + + /** A anchor for instances */ + protected CoordinateSystem anchor; + + /** * Constructs instance * @param name name *************** *** 19,21 **** --- 32,99 ---- super(name, Space.CONSTRUCTION, false); } + + /** + * {@inheritDoc} + */ + public boolean isInstance() { + return true; + } + + /** + * Get proto + * @return proto + */ + public Space getProto() { + return proto; + } + + /** + * Set proto + * @param space Space + */ + public void setProto(Space space) { + this.proto = space; + if (proto != null) { + if (anchor == null) { + this.anchor = Project.getInstance().getActiveCoordinateSystem().copy(); + } + } else { + this.anchor = null; + } + } + + /** + * Getter for anchor + * @return The anchor + */ + public CoordinateSystem getInstanceAnchor() { + if (isInstance()) { + if (anchor == null) { + anchor = Project.getInstance().getActiveCoordinateSystem().copy(); + } + return anchor; + } else { + return null; + } + } + + /** + * set the anchor for a instance + * @param cs the coordinatesystem to use as anchor + */ + public void setInstanceAnchor(CoordinateSystem cs) { + anchor = cs; + } + + + + /** + * {@inheritDoc} + */ + @Override + public Set<Vertex> collect() { + Set<Vertex> result = new HashSet<Vertex>(); + result.addAll(anchor.collect()); + return result; + } } Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** Persistence.java 12 Dec 2007 14:12:11 -0000 1.68 --- Persistence.java 12 Dec 2007 14:38:43 -0000 1.69 *************** *** 1035,1039 **** } } else { ! xml.setAnchor(externalizeCoordinateSystem(space.getInstanceAnchor(), map)); } { --- 1035,1040 ---- } } else { ! Instance instance = (Instance) space; ! xml.setAnchor(externalizeCoordinateSystem(instance.getInstanceAnchor(), map)); } { Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.220 retrieving revision 1.221 diff -C2 -d -r1.220 -r1.221 *** Space.java 12 Dec 2007 14:12:11 -0000 1.220 --- Space.java 12 Dec 2007 14:38:43 -0000 1.221 *************** *** 77,90 **** private ClassificationType productType; - - /** - * If proto points to another space, this space - * is an instance of the other space and is not - * a container. - * - * FIXME Should be handled by a class hierarchy. - */ - private Space proto; - /** The empty space in this space (also called void) */ protected Space empty; --- 77,80 ---- *************** *** 121,126 **** private LinkedHashMap<String, Object> ownParameters = new LinkedHashMap<String, Object>(); ! /** A anchor for instances */ ! private CoordinateSystem anchor; /** --- 111,115 ---- private LinkedHashMap<String, Object> ownParameters = new LinkedHashMap<String, Object>(); ! /** *************** *** 263,289 **** /** - * Set proto - * @param space Space - */ - public void setProto(Space space) { - this.proto = space; - if (proto != null) { - if (anchor == null) { - this.anchor = Project.getInstance().getActiveCoordinateSystem().copy(); - } - } else { - this.anchor = null; - } - } - - /** - * Get proto - * @return proto - */ - public Space getProto() { - return proto; - } - - /** * * @return isContainer --- 252,255 ---- *************** *** 1381,1387 **** result.addAll(s.collect()); } - if (isInstance()) { - result.addAll(anchor.collect()); - } if (container) { result.addAll(collectInterior()); --- 1347,1350 ---- *************** *** 1888,1894 **** * @return true if it is a instance otherwise false */ ! public boolean isInstance() { ! return proto != null; ! } /** --- 1851,1855 ---- * @return true if it is a instance otherwise false */ ! public abstract boolean isInstance(); /** *************** *** 2300,2325 **** } - /** - * Getter for anchor - * @return The anchor - */ - public CoordinateSystem getInstanceAnchor() { - if (isInstance()) { - if (anchor == null) { - anchor = Project.getInstance().getActiveCoordinateSystem().copy(); - } - return anchor; - } else { - return null; - } - } - - /** - * set the anchor for a instance - * @param cs the coordinatesystem to use as anchor - */ - public void setInstanceAnchor(CoordinateSystem cs) { - anchor = cs; - } /** --- 2261,2264 ---- Index: Container.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Container.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Container.java 12 Dec 2007 12:48:23 -0000 1.2 --- Container.java 12 Dec 2007 14:38:43 -0000 1.3 *************** *** 28,30 **** --- 28,37 ---- super(name, type, container); } + + /** + * {@inheritDoc} + */ + public boolean isInstance() { + return false; + } } |