123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package classes;
- import java.util.ArrayList;
- public class HolonObject extends CpsObject {
-
- /*Array of all consumers*/
- private ArrayList<HolonElement> consumers;
- /*Array of all producers*/
- private ArrayList<HolonElement> 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;
- }
-
- }
|