Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22141/src/net/sourceforge/bprocessor/model
Modified Files:
Edge.java Vertex.java
Log Message:
Modified Edge and Vertex to be parametric
Index: Edge.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** Edge.java 3 Feb 2006 13:01:49 -0000 1.31
--- Edge.java 8 Feb 2006 10:14:14 -0000 1.32
***************
*** 9,12 ****
--- 9,13 ----
import org.apache.log4j.Logger;
+ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
***************
*** 23,27 ****
* usage="read-write"
*/
! public class Edge extends Geometric {
/** The logger */
private static Logger log = Logger.getLogger(Edge.class);
--- 24,28 ----
* usage="read-write"
*/
! public class Edge extends Geometric implements Parametric {
/** The logger */
private static Logger log = Logger.getLogger(Edge.class);
***************
*** 407,409 ****
--- 408,439 ----
return false;
}
+
+ /**
+ * Set the attributes of the object to the values in the list
+ * @param attributes The attributes to set
+ */
+ public void setAttributes(List attributes) {
+ Iterator iter = attributes.iterator();
+ while (iter.hasNext()) {
+ Attribute a = (Attribute)iter.next();
+ if (a.getName().equals("Name")) {
+ System.out.println("");
+ } else if (a.getName().equals("Length")) {
+ setLength(((Double)a.getValue()).doubleValue());
+ } else {
+ log.error("Wrong attribute for the object " + a);
+ }
+ }
+ }
+
+ /**
+ * Return a list of the attributes in the object
+ * @return the list of attributes for the object
+ */
+ public List getAttributes() {
+ ArrayList res = new ArrayList();
+ res.add(new Attribute("Name", getName()));
+ res.add(new Attribute("Length", new Double(getLength())));
+ return res;
+ }
}
Index: Vertex.java
===================================================================
RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** Vertex.java 3 Feb 2006 13:01:49 -0000 1.23
--- Vertex.java 8 Feb 2006 10:14:14 -0000 1.24
***************
*** 7,13 ****
--- 7,15 ----
package net.sourceforge.bprocessor.model;
+ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
+ import java.util.List;
import java.util.Set;
***************
*** 22,26 ****
* usage="read-write"
*/
! public class Vertex extends Geometric {
/** The logger */
private static Logger log = Logger.getLogger(Vertex.class);
--- 24,28 ----
* usage="read-write"
*/
! public class Vertex extends Geometric implements Parametric {
/** The logger */
private static Logger log = Logger.getLogger(Vertex.class);
***************
*** 333,335 ****
--- 335,372 ----
return this;
}
+
+ /**
+ * Set the attributes of the object to the values in the list
+ * @param attributes The attributes to set
+ */
+ public void setAttributes(List attributes) {
+ Iterator iter = attributes.iterator();
+ while (iter.hasNext()) {
+ Attribute a = (Attribute)iter.next();
+ if (a.getName().equals("Name")) {
+ System.out.println("");
+ } else if (a.getName().equals("X")) {
+ setX(((Double)a.getValue()).doubleValue());
+ } else if (a.getName().equals("Y")) {
+ setY(((Double)a.getValue()).doubleValue());
+ } else if (a.getName().equals("Z")) {
+ setZ(((Double)a.getValue()).doubleValue());
+ } else {
+ log.error("Wrong attribute for the object " + a);
+ }
+ }
+ }
+
+ /**
+ * Return a list of the attributes in the object
+ * @return the list of attributes for the object
+ */
+ public List getAttributes() {
+ ArrayList res = new ArrayList();
+ res.add(new Attribute("Name", getName()));
+ res.add(new Attribute("X", new Double(getX())));
+ res.add(new Attribute("Y", new Double(getY())));
+ res.add(new Attribute("Z", new Double(getZ())));
+ return res;
+ }
}
|