package classes; import java.util.ArrayList; public class HolonObject extends CpsObject { /*Array of all consumers*/ private ArrayList consumers; /*Array of all producers*/ private ArrayList producers; /*Total of consumption*/ private float currentEnergy; /** * State of the building: * 0 = fully supplied (currentEnergy == 0) * 1 = not enough energy (currentEnergy > 0) * 2 = oversupplied (currentEnergy < 0) */ int state; /** * Constructor * Set by default the name of the object equals to the category name, until the user changes it. */ public HolonObject(String ObjName) { super(ObjName); } public HolonObject(CpsObject obj) { super(obj.objName); /* this.consumers = obj.consumers; this.producers = obj.producers; */ } public void addConsumer(HolonElement consumer){ consumers.add(consumer); } public void addProducer(HolonElement producer){ producers.add(producer); } public void deleteConsumer(int idx){ consumers.remove(idx); } public void deleteProducer(int idx){ producers.remove(idx); } public float calculateCurrentEnergy(){ return currentEnergy; } }