package classes; public class HolonElement { /* Name of the gadget */ String eleName; /* Quantity */ int amount; /* Energy per gadget */ float energy; /* If the gadget is working xor not (true xor false) */ boolean active; /* Total Energy */ float totalEnergy; /* Path of the image for the Obj. */ String image; /* +: for Consumers and -: Producers */ char sign; String stored; /* * Energy at each point of the graph with 50 predefined points. At the * beginning, it starts with all values at energy */ float[] energyAt = new float[49]; public HolonElement(String eleName, float energy, int amount) { setEleName(eleName); setAmount(amount); setEnergy(energy); setActive(true); setSign(energy); setEnergyAt(energy); } public HolonElement(HolonElement element) { setEleName(element.getEleName()); setAmount(element.getAmount()); setEnergy(element.getEnergy()); setActive(element.getActive()); setSign(element.getEnergy()); setEnergyAt(element.getEnergy()); } public float[] getEnergyAt() { return energyAt; } public void setEnergyAt(float energy) { for (int i = 0; i < 49; i++) { this.energyAt[i] = energy; } } public void setEnergyAt(int pos, float energy) { this.energyAt[pos] = energy; } /** * @return the name */ public String getEleName() { return eleName; } /** * @param name * the name to set */ public void setEleName(String name) { this.eleName = name; } /** * @return the amount */ public int getAmount() { return amount; } /** * @param amount * the amount to set */ public void setAmount(int amount) { this.amount = amount; } /** * @return the energy */ public float getEnergy() { return energy; } /** * @param energy * the energy to set */ public void setEnergy(float energy) { this.energy = energy; } /** * @return the active */ public boolean getActive() { return active; } /** * @param active * the active to set */ public void setActive(boolean active) { this.active = active; } /** * @return the image */ public String getImage() { return image; } /** * @param image * the image to set */ public void setImage(String image) { this.image = image; } /** * Multiply the amount of gadgets, given by the user, and the * consumption/production. If the switch isWorking is turned off for on * gadget, the energy of this gadget have to be subtracted * * @return totalEnergy (actual) */ public float getTotalEnergy() { totalEnergy = ((float) amount) * energy; return totalEnergy; } /** * @return the sign */ public char getSign() { return sign; } /** * @param energy * the sign to set */ public void setSign(float energy) { if (energy < 0) this.sign = '-'; else this.sign = '+'; } /** * @return the stored */ public String getStored() { return stored; } /** * @param stored the stored to set */ public void setStored(String stored) { this.stored = stored; } }