Thread: [Bprocessor-commit] /model/src/net/sourceforge/bprocessor/model Edge.java, 1.82, 1.83 Vertex.java,
Status: Pre-Alpha
Brought to you by:
henryml
Update of /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3197/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Parametric.java ParameterBlock.java Project.java Selection.java Log Message: altered selection to a generic collection og geometrics which lead to quite alot of changes Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** Edge.java 11 Apr 2007 08:44:58 -0000 1.82 --- Edge.java 14 Apr 2007 15:00:47 -0000 1.83 *************** *** 76,81 **** * @return Collection of vertices in random order */ ! public static Collection vertices(Collection edges) { ! Set vertices = new HashSet(); Iterator iter = edges.iterator(); while (iter.hasNext()) { --- 76,81 ---- * @return Collection of vertices in random order */ ! public static Collection<Vertex> vertices(Collection edges) { ! Set<Vertex> vertices = new HashSet<Vertex>(); Iterator iter = edges.iterator(); while (iter.hasNext()) { Index: Parametric.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Parametric.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Parametric.java 29 Jan 2007 18:08:45 -0000 1.3 --- Parametric.java 14 Apr 2007 15:00:47 -0000 1.4 *************** *** 18,22 **** * @param attributes The attributes to set */ ! public void setAttributes(List attributes); /** --- 18,22 ---- * @param attributes The attributes to set */ ! public void setAttributes(List<Attribute> attributes); /** *************** *** 24,28 **** * @return the list of attributes for the object */ ! public List getAttributes(); /** --- 24,28 ---- * @return the list of attributes for the object */ ! public List<Attribute> getAttributes(); /** Index: ParameterBlock.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/ParameterBlock.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ParameterBlock.java 11 Apr 2007 12:19:41 -0000 1.7 --- ParameterBlock.java 14 Apr 2007 15:00:47 -0000 1.8 *************** *** 23,27 **** /** Parameters */ ! private List parameters; /** --- 23,27 ---- /** Parameters */ ! private List<Attribute> parameters; /** *************** *** 30,34 **** public ParameterBlock() { super(); ! parameters = new LinkedList(); } --- 30,34 ---- public ParameterBlock() { super(); ! parameters = new LinkedList<Attribute>(); } *************** *** 37,41 **** * @param attributes List of Attribute */ ! public void setAttributes(List attributes) { parameters = attributes; } --- 37,41 ---- * @param attributes List of Attribute */ ! public void setAttributes(List<Attribute> attributes) { parameters = attributes; } *************** *** 45,49 **** * @return List if Attribute */ ! public List getAttributes() { return parameters; } --- 45,49 ---- * @return List if Attribute */ ! public List<Attribute> getAttributes() { return parameters; } *************** *** 88,93 **** * @return HashMap */ ! public HashMap environment() { ! HashMap env = new HashMap(); Iterator iter = parameters.iterator(); while (iter.hasNext()) { --- 88,93 ---- * @return HashMap */ ! public HashMap<String, Object> environment() { ! HashMap<String, Object> env = new HashMap<String, Object>(); Iterator iter = parameters.iterator(); while (iter.hasNext()) { Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** Project.java 21 Mar 2007 11:58:06 -0000 1.117 --- Project.java 14 Apr 2007 15:00:47 -0000 1.118 *************** *** 22,27 **** --- 22,31 ---- import java.util.StringTokenizer; + import net.sourceforge.bprocessor.model.modellor.Cylinder; import net.sourceforge.bprocessor.model.modellor.LayerModellor; + import net.sourceforge.bprocessor.model.modellor.ModelBathModellor; import net.sourceforge.bprocessor.model.modellor.Modellor; + import net.sourceforge.bprocessor.model.modellor.TileModellor; + import net.sourceforge.bprocessor.model.modellor.WindowModellor; import net.sourceforge.bprocessor.model.xml.Bmodel; *************** *** 108,112 **** /** The copy buffer */ ! private Collection copyBuffer; /** Flag set when updating */ --- 112,116 ---- /** The copy buffer */ ! private Collection<Geometric> copyBuffer; /** Flag set when updating */ *************** *** 155,158 **** --- 159,167 ---- globals.put("roof", 0.07); Modellor.registerModellor(new LayerModellor()); + Modellor.registerModellor(new TileModellor(null)); + Modellor.registerModellor(new Cylinder()); + Modellor.registerModellor(new WindowModellor()); + Modellor.registerModellor(new ModelBathModellor()); + try { loadClassification(true); *************** *** 1152,1156 **** * @return The copyBuffer */ ! public Collection getCopyBuffer() { return copyBuffer; } --- 1161,1165 ---- * @return The copyBuffer */ ! public Collection<Geometric> getCopyBuffer() { return copyBuffer; } Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** Vertex.java 23 Mar 2007 15:27:18 -0000 1.57 --- Vertex.java 14 Apr 2007 15:00:47 -0000 1.58 *************** *** 514,519 **** * @return Edges */ ! public static Set edges(Collection vertices) { ! Set edges = new HashSet(); Iterator iter = vertices.iterator(); while (iter.hasNext()) { --- 514,519 ---- * @return Edges */ ! public static Set<Edge> edges(Collection vertices) { ! Set<Edge> edges = new HashSet<Edge>(); Iterator iter = vertices.iterator(); while (iter.hasNext()) { Index: Selection.java =================================================================== RCS file: /cvsroot/bprocessor//model/src/net/sourceforge/bprocessor/model/Selection.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Selection.java 24 Jan 2007 15:17:50 -0000 1.17 --- Selection.java 14 Apr 2007 15:00:47 -0000 1.18 *************** *** 21,36 **** * in the userinterface. */ ! public class Selection implements Collection { /** The logger */ private static Logger log = Logger.getLogger(Selection.class); /** The collection of objects mark is used to test for membership */ ! private Set mark; /** The order of the objects */ ! private List selection; /** The observers */ ! private List observers; /** The primary selection */ --- 21,36 ---- * in the userinterface. */ ! public class Selection implements Collection<Geometric> { /** The logger */ private static Logger log = Logger.getLogger(Selection.class); /** The collection of objects mark is used to test for membership */ ! private Set<Geometric> mark; /** The order of the objects */ ! private List<Geometric> selection; /** The observers */ ! private List<Observer> observers; /** The primary selection */ *************** *** 50,56 **** public Selection() { super(); ! mark = new HashSet(); ! selection = new LinkedList(); ! observers = new LinkedList(); } --- 50,56 ---- public Selection() { super(); ! mark = new HashSet<Geometric>(); ! selection = new LinkedList<Geometric>(); ! observers = new LinkedList<Observer>(); } *************** *** 69,73 **** * @return True if changed */ ! public boolean add(Object object) { if (object == null) { throw new Error("Null object added to selection"); --- 69,73 ---- * @return True if changed */ ! public boolean add(Geometric object) { if (object == null) { throw new Error("Null object added to selection"); *************** *** 102,106 **** /** * Clear the selection ! * ONLY TO BE USED IF NOTHING IS ADDED TO THE SELECTION */ public void clear() { --- 102,106 ---- /** * Clear the selection ! * ONLY TO BE USED IF NOTHING IS ADDED TO THE SELECTION OTHERWISE USE OVERRIDE */ public void clear() { *************** *** 124,128 **** * @param object The object */ ! public void set(Object object) { clean(); add(object); --- 124,128 ---- * @param object The object */ ! public void set(Geometric object) { clean(); add(object); *************** *** 130,137 **** /** * Return an iterator * @return An iterator */ ! public Iterator iterator() { return selection.iterator(); } --- 130,146 ---- /** + * Empty the selection and add the given list instead + * @param geos the geometrics to add + */ + public void set(Collection<Geometric> geos) { + clean(); + addAll(geos); + } + + /** * Return an iterator * @return An iterator */ ! public Iterator<Geometric> iterator() { return selection.iterator(); } *************** *** 190,197 **** /** * Add all elements to array * @param array Elements to add * @return The array */ ! public Object[] toArray(Object[] array) { return selection.toArray(array); } --- 199,207 ---- /** * Add all elements to array + * @param <T> The type of the wanted array * @param array Elements to add * @return The array */ ! public <T> T[] toArray(T[] array) { return selection.toArray(array); } *************** *** 202,206 **** * @return True if all elements are contained in this selection */ ! public boolean containsAll(Collection objects) { return mark.containsAll(objects); } --- 212,216 ---- * @return True if all elements are contained in this selection */ ! public boolean containsAll(Collection<?> objects) { return mark.containsAll(objects); } *************** *** 211,224 **** * @return True if changed */ ! public boolean addAll(Collection objects) { boolean touched = false; ! Iterator iter = objects.iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! if (!(current instanceof Geometric)) { ! throw new Error("Illegal object added to selection " + current.getClass().getName()); ! } ! if (mark.add(current)) { ! selection.add(current); touched = true; } --- 221,229 ---- * @return True if changed */ ! public boolean addAll(Collection<? extends Geometric> objects) { boolean touched = false; ! for (Geometric current : objects) { ! if (mark.add((Geometric)current)) { ! selection.add((Geometric)current); touched = true; } *************** *** 237,241 **** * @return True if changed */ ! public boolean removeAll(Collection objects) { boolean touched = false; Iterator iter = objects.iterator(); --- 242,246 ---- * @return True if changed */ ! public boolean removeAll(Collection<?> objects) { boolean touched = false; Iterator iter = objects.iterator(); *************** *** 256,278 **** /** ! * Retain all elements in collection ! * @param objects Collection ! * @return True if changed ! */ ! public boolean retainAll(Collection objects) { ! clean(); ! addAll(objects); ! return true; ! } ! ! /** ! * Retain the given elements in collection ! * @param object the object ! * @return True if changed */ ! public boolean retain(Object object) { ! clean(); ! add(object); ! return true; } --- 261,268 ---- /** ! * {@inheritDoc} */ ! public boolean retainAll(Collection<?> objects) { ! return selection.retainAll(objects); } *************** *** 298,303 **** * @return Collection of Vertex */ ! public Set collect() { ! Set vertices = new HashSet(); Iterator iter = iterator(); while (iter.hasNext()) { --- 288,293 ---- * @return Collection of Vertex */ ! public Set<Vertex> collect() { ! Set<Vertex> vertices = new HashSet<Vertex>(); Iterator iter = iterator(); while (iter.hasNext()) { *************** *** 311,314 **** --- 301,305 ---- * @return String */ + @Override public String toString() { return selection.toString(); |