Parcourir la source

Fixed an issue where some constructors created bad HolonElements

Ludwig Tietze il y a 6 ans
Parent
commit
f4a627161d
1 fichiers modifiés avec 2 ajouts et 4 suppressions
  1. 2 4
      src/classes/HolonElement.java

+ 2 - 4
src/classes/HolonElement.java

@@ -86,10 +86,8 @@ public class HolonElement implements IGraphedElement{
      * same as standard constructor, but with already given id (so the counter is not increased twice)
      */
     public HolonElement(String eleName, int amount, float energy, int id, Model model){
-    	setLocalPeriod(model.getGraphIterations());
-    	setStretching(IGraphedElement.STRETCH_BY_DEFAULT);	//Change this to set whether
-    														//HolonElements and -Switches
-    														//"use global" by default
+    	setLocalPeriod(model==null?UnitGraph.STANDARD_GRAPH_ACCURACY:model.getGraphIterations());
+    	setStretching(IGraphedElement.STRETCH_BY_DEFAULT);
     	setEleName(eleName);
         setAmount(amount);
         setEnergyPerElement(energy);