Ver Fonte

Fixed an issue where some constructors created bad HolonElements

Ludwig Tietze há 6 anos atrás
pai
commit
f4a627161d
1 ficheiros alterados com 2 adições e 4 exclusões
  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);