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 */ String sign; public HolonElement(String eleName, float energy, int amount) { setEleName(eleName); setAmount(amount); setEnergy(energy); setActive(true); if (energy < 0) { setSign("-"); } else { setSign("+"); } } /** * @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 setActive() { 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; } public void setSign(String s) { this.sign = s; } public String getSign() { return sign; } }