123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- 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;
- }
- }
|