Supplier.java 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package ui.model;
  2. import java.util.ArrayList;
  3. import classes.HolonObject;
  4. public class Supplier extends DecoratedHolonObject {
  5. private ArrayList<ConsumerListEntry> consumerList = new ArrayList<ConsumerListEntry>();
  6. private float energyToSupplyNetwork;
  7. private float energySupplied;
  8. public Supplier(HolonObject objectToLookAt, float energyToSupplyNetwork) {
  9. super(objectToLookAt);
  10. this.energyToSupplyNetwork = energyToSupplyNetwork;
  11. energySupplied = 0.0f;
  12. }
  13. @Override
  14. float getEnergy() {
  15. return energyToSupplyNetwork;
  16. }
  17. public ArrayList<ConsumerListEntry> getConsumerList() {
  18. return consumerList;
  19. }
  20. public void setConsumerList(ArrayList<ConsumerListEntry> consumerList) {
  21. this.consumerList = consumerList;
  22. }
  23. public float getEnergyToSupplyNetwork() {
  24. return energyToSupplyNetwork;
  25. }
  26. public float getEnergySupplied() {
  27. return energySupplied;
  28. }
  29. public void setEnergySupplied(float energySupplied) {
  30. this.energySupplied = energySupplied;
  31. }
  32. public class ConsumerListEntry{
  33. public Consumer consumer;
  34. public float energyToConsumer;
  35. public ConsumerListEntry(Consumer consumer, float energyToConsumer) {
  36. this.consumer= consumer;
  37. this.energyToConsumer = energyToConsumer;
  38. }
  39. }
  40. @Override
  41. public String toString() {
  42. return getModel().getName();
  43. }
  44. }