[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Project.java, 1.70, 1.71
Status: Pre-Alpha
Brought to you by:
henryml
From: Nikolaj B. <nbr...@us...> - 2006-09-11 09:22:56
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10172/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Project is now parametric and has a name and gives info about energy etc Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** Project.java 23 Aug 2006 13:43:19 -0000 1.70 --- Project.java 11 Sep 2006 09:22:46 -0000 1.71 *************** *** 9,12 **** --- 9,13 ---- import java.io.File; + import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; *************** *** 30,34 **** * */ ! public class Project { /** The logger */ private static Logger log = Logger.getLogger(Project.class); --- 31,35 ---- * */ ! public class Project implements Parametric { /** The logger */ private static Logger log = Logger.getLogger(Project.class); *************** *** 85,88 **** --- 86,92 ---- private CoordinateSystem activeCoordinateSystem; + /** The name of the project */ + private String name; + /** * Get the instance *************** *** 101,104 **** --- 105,109 ---- public Project() { super(); + name = "new project"; undoStack = new Stack(); redoStack = new Stack(); *************** *** 901,903 **** --- 906,963 ---- return res; } + + /** + * 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")) { + setName((String)a.getValue()); + } + } + } + + /** + * 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("Energyloss", new Double(EnergyCalc.energyLoss()), false)); + res.add(new Attribute("Heated area", new Double(EnergyCalc.heatedArea()), false)); + if (EnergyCalc.heatedArea() != 0) { + res.add(new Attribute("loss per m2", + new Double(EnergyCalc.energyLoss() / EnergyCalc.heatedArea()), false)); + } + return res; + } + + + /** + * @see net.sourceforge.bprocessor.model.Parametric#getGeneralName() + */ + public String getGeneralName() { + return "Project"; + } + + /** + * Get the name + * @return The name + * @hibernate.property + */ + public String getName() { + return name; + } + + /** + * Set the name + * @param name The name + */ + public void setName(String name) { + this.name = name; + } } |