Pārlūkot izejas kodu

Wip

Removes DecoratedHolonObjects
TomTroppmann 2 gadi atpakaļ
vecāks
revīzija
e18bfdc8b7

+ 278 - 221
src/holeg/model/HolonObject.java

@@ -1,13 +1,11 @@
 package holeg.model;
 
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-
-
 /**
  * The class HolonObject represents any Object on the system which capability of
  * injecting or consuming energy on the network, for instance a house or a power
@@ -15,245 +13,304 @@ import java.util.stream.Stream;
  *
  * @author Gruppe14
  */
-public class HolonObject extends AbstractCanvasObject { 
-    /* Array of all consumers */
-    private List<HolonElement> elements = new ArrayList<HolonElement>();
-    
-    
-    /**
-     * Constructor Set by default the name of the object equals to the category
-     * name, until the user changes it.
-     *
-     * @param objName name of the Object
-     */
-    public HolonObject(String objName) {
-        super(objName);
-    }
-
-    /**
-     * Contructor of a copy of an Object.
-     *
-     * @param obj object to be copied
-     */
-    public HolonObject(HolonObject obj) {
-        super(obj);
-        for(HolonElement ele : obj.elements) {
-        	this.add(new HolonElement(ele));
-        }
-    }
-
-    @Override
-    public void initForReflection() {
-    	elements = new ArrayList<HolonElement>();
-    }
-    
-    
- 
-
-    /**
-     * Getter for all Elements in the HolonObject.
-     *
-     * @return the elements ArrayList
-     */
-    public Stream<HolonElement> getElements() {
-        return elements.stream();
-    }
-    
-    public void clearElements() {
-    	elements.clear();
-    }
-
-    /**
-     * adds an Element to the Object.
-     *
-     * @param element the Element to add
-     */
-    public void add(HolonElement element) {
-        elements.add(element);
-        element.parentObject = this;
-    }
-    
-    /**
-     * adds an Element to the Object.
-     *
-     * @param element the Element to add
-     */
-    public void add(Collection<HolonElement> elements) {
-    	for(HolonElement hE : elements) {
-    		hE.parentObject = this;    		
-    	}
-    	this.elements.addAll(elements);
-    }
-    
-    
-    /**
-     * remove an Element to the Object.
-     *
-     * @param element the Element to add
-     */
-    public void remove(HolonElement element) {
-        elements.remove(element);
-        element.parentObject = null;
-    }
-
-    public void removeElement(int index) {
-    	HolonElement ele = elements.remove(index);
-    	ele.parentObject = null;
-	}
-    
-    /**
-     * This Method returns the smallest consuming HolonElement that is ACTIVE.
-     * If the HolonObject has no Consumer its return null. 
-     * @param timestep is the TimeStep to compare the HolonElements.
-     * @return The smallest consuming HolonElement or null.
-     */
-    public HolonElement getMinimumConsumingElement(){
-    	return elements.stream().filter(element -> element.getActualEnergy() < 0).max((lhs,rhs) -> Float.compare(lhs.getActualEnergy(), rhs.getActualEnergy())).orElse(null);
-    }
-    /**
-     * This Method returns the smallest consuming HolonElement'Energy that is ACTIVE.
-     * If the HolonObject has no Consumer its return 0. 
-     * @param timestep is the TimeStep to compare the HolonElements.
-     * @return The smallest consuming HolonElement or 0.
-     */
-    public float getMinimumConsumingElementEnergy(){
-    	return elements.stream().filter(element -> element.getActualEnergy() < 0 ).map(element -> -element.getActualEnergy()).min((lhs,rhs) ->Float.compare(lhs, rhs)).orElse(0.0f);
-    }
-    /**
-     * This Method returns the biggest consuming HolonElement'Energy that is ACTIVE.
-     * If the HolonObject has no Consumer its return 0. 
-     * @param timestep is the TimeStep to compare the HolonElements.
-     * @return The biggest consuming HolonElement or 0.
-     */
-    public float getMaximumConsumingElementEnergy(){
-    	return elements.stream().filter(element -> element.getActualEnergy() < 0 ).map(element -> -element.getActualEnergy()).max((lhs,rhs) ->Float.compare(lhs, rhs)).orElse(0.0f);
-    }
-    
-    
-    public float getMaximumProductionPossible() {
-    	return elements.stream().filter(element -> element.getEnergy() > 0).map(element -> element.getEnergy()).reduce(0.0f, Float::sum);
-    }
-    public float getMaximumConsumptionPossible() {
-    	return elements.stream().filter(element -> element.getEnergy() < 0).map(element -> -element.getEnergy()).reduce(0.0f, Float::sum);
-    }
-    
-    /** 
-     * This Method returns the Energy that all HolonElements from the HolonObject produce by itself. Its sums all Energies from the HolonElements of the HolonObject that are ACTIVE and are Producer.
-     * If the HolonObject have no HolonElement its return 0;
-     * @param timestep is the TimeStep to compare the HolonElements.
-     * @return The Energy of the producing HolonElements.
-     */
-    public float getEnergySelfProducingFromProducingElements() {
-    	return elements.stream().filter(element -> element.getActualEnergy() > 0).map(element -> element.getActualEnergy()).reduce(0.0f, Float::sum);
-    }
-    /** 
-     * This Method returns the Energy of all HolonElements from the HolonObject that are consuming. Its sums all Energies from the HolonElements of the HolonObject that are ACTIVE and are Consumer.
-     * If the HolonObject have no HolonElement its return 0;
-     * @param timestep is the TimeStep to compare the HolonElements.
-     * @return The Energy of the consuming HolonElements.
-     */
-    public float getEnergyNeededFromConsumingElements() {
-    	return elements.stream().filter(element -> element.getActualEnergy() < 0).map(element -> -element.getActualEnergy()).reduce(0.0f, Float::sum);
-    }
-    /**
-     * This Method calculate the amount of HolonElements that are consuming Energy and are ACTIVE.
-     * @param timestep is the TimeStep to compare the HolonElements.
-     * @return The amount of HolonElements that are consuming Energy.
-     */
-    public int countConsumingElements() {
-    	return (int) elements.stream().filter(element ->  element.getActualEnergy() < 0).count();
-    }
-    /**
-     * This Method calculate the amount of HolonElements that are producing Energy and are ACTIVE.
-     * @param timestep is the TimeStep to compare the HolonElements.
-     * @return The amount of HolonElements that are producing Energy.
-     */
-    public int countProducingElements() {
-    	return (int) elements.stream().filter(element ->  element.getActualEnergy() > 0).count();
-    }
-    
-    public int getNumberOfActiveElements() {
-    	return (int) elements.stream().filter(ele -> ele.active).count();
-    }
-    
-    public int getNumberOfInActiveElements() {
-    	return (int) elements.stream().filter(ele -> !ele.active).count();
-    }
-    
-    public int getNumberOfElements() {
-    	return elements.size();
-    }
-   
-    /*
-     * STATE
-     */
-    private float actualEnergy;
-    private HolonObjectState state;
-    
-    /** 
-     * This Method returns the Energy of a HolonObject. Its sums all Energies from the HolonElements of the HolonObject that are ACTIVE.
-     * If the HolonObject have no HolonElement its return 0;
-     * Is the returned Energy negative then the HolonObject need Energy because its consuming HolonElements need more Energy then the producing HolonElements.
-     * Is the returned Energy positive its reversed.
-     * @param timestep is the TimeStep to compare the HolonElements.
-     * @return The Energy of the HolonObject.
-     */
-    public void calculateEnergy(int timestep)
-    {
-    	elements.forEach(ele -> ele.calculateState(timestep));
-    	actualEnergy = elements.stream().map(element -> element.getActualEnergy()).reduce(0.0f, Float::sum);
-    }
-    
-    
-    public float getActualEnergy()
-    {
-    	return actualEnergy;
-    }
+public class HolonObject extends AbstractCanvasObject {
+	/* Array of all consumers */
+	private List<HolonElement> elements = new ArrayList<HolonElement>();
+
+	/**
+	 * Constructor Set by default the name of the object equals to the category
+	 * name, until the user changes it.
+	 *
+	 * @param objName name of the Object
+	 */
+	public HolonObject(String objName) {
+		super(objName);
+	}
+
+	/**
+	 * Contructor of a copy of an Object.
+	 *
+	 * @param obj object to be copied
+	 */
+	public HolonObject(HolonObject obj) {
+		super(obj);
+		for (HolonElement ele : obj.elements) {
+			this.add(new HolonElement(ele));
+		}
+	}
+
+	@Override
+	public void initForReflection() {
+		elements = new ArrayList<HolonElement>();
+	}
+
+	/**
+	 * Getter for all Elements in the HolonObject.
+	 *
+	 * @return the elements ArrayList
+	 */
+	public Stream<HolonElement> getElements() {
+		return elements.stream();
+	}
+
+	public void clearElements() {
+		elements.clear();
+	}
+
+	/**
+	 * adds an Element to the Object.
+	 *
+	 * @param element the Element to add
+	 */
+	public void add(HolonElement element) {
+		elements.add(element);
+		element.parentObject = this;
+	}
+
+	/**
+	 * adds an Element to the Object.
+	 *
+	 * @param element the Element to add
+	 */
+	public void add(Collection<HolonElement> elements) {
+		for (HolonElement hE : elements) {
+			hE.parentObject = this;
+		}
+		this.elements.addAll(elements);
+	}
+
+	/**
+	 * remove an Element to the Object.
+	 *
+	 * @param element the Element to add
+	 */
+	public void remove(HolonElement element) {
+		elements.remove(element);
+		element.parentObject = null;
+	}
+
+	public void removeElement(int index) {
+		HolonElement ele = elements.remove(index);
+		ele.parentObject = null;
+	}
+
+	/**
+	 * This Method returns the smallest consuming HolonElement that is ACTIVE. If
+	 * the HolonObject has no Consumer its return null.
+	 * 
+	 * @param timestep is the TimeStep to compare the HolonElements.
+	 * @return The smallest consuming HolonElement or null.
+	 */
+	public HolonElement getMinimumConsumingElement() {
+		return elements.stream().filter(element -> element.getActualEnergy() < 0)
+				.max((lhs, rhs) -> Float.compare(lhs.getActualEnergy(), rhs.getActualEnergy())).orElse(null);
+	}
+
+	/**
+	 * This Method returns the smallest consuming HolonElement'Energy that is
+	 * ACTIVE. If the HolonObject has no Consumer its return 0.
+	 * 
+	 * @param timestep is the TimeStep to compare the HolonElements.
+	 * @return The smallest consuming HolonElement or 0.
+	 */
+	public float getMinimumConsumingElementEnergy() {
+		return elements.stream().filter(element -> element.getActualEnergy() < 0)
+				.map(element -> -element.getActualEnergy()).min((lhs, rhs) -> Float.compare(lhs, rhs)).orElse(0.0f);
+	}
+
+	/**
+	 * This Method returns the biggest consuming HolonElement'Energy that is ACTIVE.
+	 * If the HolonObject has no Consumer its return 0.
+	 * 
+	 * @param timestep is the TimeStep to compare the HolonElements.
+	 * @return The biggest consuming HolonElement or 0.
+	 */
+	public float getMaximumConsumingElementEnergy() {
+		return elements.stream().filter(element -> element.getActualEnergy() < 0)
+				.map(element -> -element.getActualEnergy()).max((lhs, rhs) -> Float.compare(lhs, rhs)).orElse(0.0f);
+	}
+
+	public float getMaximumProductionPossible() {
+		return elements.stream().filter(element -> element.getEnergy() > 0).map(element -> element.getEnergy())
+				.reduce(0.0f, Float::sum);
+	}
+
+	public float getMaximumConsumptionPossible() {
+		return elements.stream().filter(element -> element.getEnergy() < 0).map(element -> -element.getEnergy())
+				.reduce(0.0f, Float::sum);
+	}
+
+	/**
+	 * This Method returns the Energy that all HolonElements from the HolonObject
+	 * produce by itself. Its sums all Energies from the HolonElements of the
+	 * HolonObject that are ACTIVE and are Producer. If the HolonObject have no
+	 * HolonElement its return 0;
+	 * 
+	 * @param timestep is the TimeStep to compare the HolonElements.
+	 * @return The Energy of the producing HolonElements.
+	 */
+	public float getEnergySelfProducingFromProducingElements() {
+		return elements.stream().filter(element -> element.getActualEnergy() > 0)
+				.map(element -> element.getActualEnergy()).reduce(0.0f, Float::sum);
+	}
+
+	/**
+	 * This Method returns the Energy of all HolonElements from the HolonObject that
+	 * are consuming. Its sums all Energies from the HolonElements of the
+	 * HolonObject that are ACTIVE and are Consumer. If the HolonObject have no
+	 * HolonElement its return 0;
+	 * 
+	 * @param timestep is the TimeStep to compare the HolonElements.
+	 * @return The Energy of the consuming HolonElements.
+	 */
+	public float getEnergyNeededFromConsumingElements() {
+		return elements.stream().filter(element -> element.getActualEnergy() < 0)
+				.map(element -> -element.getActualEnergy()).reduce(0.0f, Float::sum);
+	}
+
+	/**
+	 * This Method calculate the amount of HolonElements that are consuming Energy
+	 * and are ACTIVE.
+	 * 
+	 * @param timestep is the TimeStep to compare the HolonElements.
+	 * @return The amount of HolonElements that are consuming Energy.
+	 */
+	public int countConsumingElements() {
+		return (int) elements.stream().filter(element -> element.getActualEnergy() < 0).count();
+	}
+
+	/**
+	 * This Method calculate the amount of HolonElements that are producing Energy
+	 * and are ACTIVE.
+	 * 
+	 * @param timestep is the TimeStep to compare the HolonElements.
+	 * @return The amount of HolonElements that are producing Energy.
+	 */
+	public int countProducingElements() {
+		return (int) elements.stream().filter(element -> element.getActualEnergy() > 0).count();
+	}
+
+	public int getNumberOfActiveElements() {
+		return (int) elements.stream().filter(ele -> ele.active).count();
+	}
+
+	public int getNumberOfInActiveElements() {
+		return (int) elements.stream().filter(ele -> !ele.active).count();
+	}
+
+	public int getNumberOfElements() {
+		return elements.size();
+	}
+
+	/*
+	 * STATE
+	 */
+	private float actualEnergy;
+	private HolonObjectState state;
+	private float energyFromNetwork;
+	private float minimumConsumingElementEnergy;
+	private float energyNeededFromNetwork;
+	private float energyFromConsumingElemnets;
+	private float energySelfSupplied;
+
+	/**
+	 * This Method returns the Energy of a HolonObject. Its sums all Energies from
+	 * the HolonElements of the HolonObject that are ACTIVE. If the HolonObject have
+	 * no HolonElement its return 0; Is the returned Energy negative then the
+	 * HolonObject need Energy because its consuming HolonElements need more Energy
+	 * then the producing HolonElements. Is the returned Energy positive its
+	 * reversed.
+	 * 
+	 * @param timestep is the TimeStep to compare the HolonElements.
+	 * @return The Energy of the HolonObject.
+	 */
+	public void calculateEnergy(int timestep) {
+		elements.forEach(ele -> ele.calculateState(timestep));
+		actualEnergy = elements.stream().map(element -> element.getActualEnergy()).reduce(0.0f, Float::sum);
+	}
+
+	public float getActualEnergy() {
+		return actualEnergy;
+	}
 
 	public enum HolonObjectState {
 		NO_ENERGY, NOT_SUPPLIED, SUPPLIED, PRODUCER, PARTIALLY_SUPPLIED, OVER_SUPPLIED
 	}
-    
+
 	public HolonObjectState getState() {
 		return state;
 	}
-	
+
 	public void setState(HolonObjectState state) {
 		this.state = state;
 	}
-    
-    
-    
 
+	public float getEnergyFromNetwork() {
+		return energyFromNetwork;
+	}
 
+	// TODO(Tom2021-01-11): Should not exist hidden or package visibility
+	public void setEnergyFromNetwork(float energyFromNetwork) {
+		this.energyFromNetwork = energyFromNetwork;
+	}
 
+	public float getMinimumConsumingElementEnergyState() {
+		return minimumConsumingElementEnergy;
+	}
 
+	// TODO(Tom2021-01-11): Should not exist hidden or package visibility
+	public void setMinimumConsumingElementEnergy(float minimumConsumingElementEnergy) {
+		this.minimumConsumingElementEnergy = minimumConsumingElementEnergy;
+	}
 
-   
+	public float getEnergyNeededFromNetwork() {
+		return energyNeededFromNetwork;
+	}
 
-    public String toString() {
-        StringBuilder sb = new StringBuilder();
+	// TODO(Tom2021-01-11): Should not exist hidden or package visibility
+	public void setEnergyNeededFromNetwork(float energyNeededFromNetwork) {
+		this.energyNeededFromNetwork = energyNeededFromNetwork;
+	}
 
-        sb.append("[HolonObject: ");
-        sb.append("id=").append(getId())
-                .append(", name=").append(name)
-                .append(", state=");
-        sb.append(", elements=[");
-        for (int i = 0; i < elements.size(); i++) {
-            HolonElement el = elements.get(i);
-            if (i != 0) {
-                sb.append(", ");
-            }
-            sb.append(el.getName());
-        }
-        sb.append("]]");
+	public float getEnergyFromConsumingElemnets() {
+		return energyFromConsumingElemnets;
+	}
 
-        return sb.toString();
-    }
+	// TODO(Tom2021-01-11): Should not exist hidden or package visibility
+	public void setEnergyFromConsumingElemnets(float energyFromConsumingElemnets) {
+		this.energyFromConsumingElemnets = energyFromConsumingElemnets;
+	}
 
-    
+	public float getEnergySelfSupplied() {
+		return energySelfSupplied;
+	}
 
+	// TODO(Tom2021-01-11): Should not exist hidden or package visibility
+	public void setEnergySelfSupplied(float energySelfSupplied) {
+		this.energySelfSupplied = energySelfSupplied;
+	}
 
+	float getCurrentEnergy() {
+		return energyFromNetwork-energyNeededFromNetwork;
+	}	
 
 	
+	public float getSupplyBarPercentage() {
+		return (getEnergyFromConsumingElemnets() > 0.001)
+				? (getEnergyFromNetwork() + this.getEnergySelfSupplied()) / getEnergyFromConsumingElemnets()
+				: 1.0f;
+	}
+
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		sb.append("[HolonObject: ").append("id=").append(getId()).append(", name=").append(name).append(", state=")
+				.append(state).append(", elements=[")
+				.append(getElements().map(HolonElement::getName).collect(Collectors.joining(", "))).append("]]");
+		return sb.toString();
+	}
+
+	
+	
+	
+	
 }

+ 0 - 85
src/holeg/ui/model/Consumer.java

@@ -1,85 +0,0 @@
-package holeg.ui.model;
-
-import java.util.ArrayList;
-
-import holeg.model.HolonObject;
-
-public class Consumer extends DecoratedHolonObject {
-
-	private ArrayList<SupplierListEntry> supplierList = new ArrayList<SupplierListEntry>();
-	private float energyFromNetwork;
-	private float minimumConsumingElementEnergy;
-	private float energyNeededFromNetwork;
-	private float energyFromConsumingElemnets;
-	private float energySelfSupplied;
-	public Consumer(HolonObject objectToLookAt) {
-		super(objectToLookAt);
-		energyNeededFromNetwork = 0.0f;
-	}
-
-	@Override
-	float getEnergy() {
-		return energyFromNetwork-energyNeededFromNetwork;
-	}
-	public float getEnergyFromNetwork() {
-		return energyFromNetwork;
-	}
-	public void setEnergyFromNetwork(float energyFromNetwork) {
-		this.energyFromNetwork = energyFromNetwork;
-	}
-
-	public float getMinimumConsumingElementEnergy() {
-		return minimumConsumingElementEnergy;
-	}
-
-	public void setMinimumConsumingElementEnergy(float minimumConsumingElementEnergy) {
-		this.minimumConsumingElementEnergy = minimumConsumingElementEnergy;
-	}
-
-	public ArrayList<SupplierListEntry> getSupplierList() {
-		return supplierList;
-	}
-
-	public void setSupplierList(ArrayList<SupplierListEntry> supplierList) {
-		this.supplierList = supplierList;
-	}
-
-	public float getEnergyNeededFromNetwork() {
-		return energyNeededFromNetwork;
-	}
-
-	public void setEnergyNeededFromNetwork(float energyNeededFromNetwork) {
-		this.energyNeededFromNetwork = energyNeededFromNetwork;
-	}
-	@Override
-	public String toString() {
-		return getModel().getName() + ":" + getModel().getId()  + ", Energy: "+ getEnergy() +
-				" [" + (energyFromNetwork + energySelfSupplied) +"/" + energyFromConsumingElemnets +"]";	
-	}
-	public float getEnergyFromConsumingElemnets() {
-		return energyFromConsumingElemnets;
-	}
-
-	public void setEnergyFromConsumingElemnets(float energyFromConsumingElemnets) {
-		this.energyFromConsumingElemnets = energyFromConsumingElemnets;
-	}
-	public float getEnergySelfSupplied() {
-		return energySelfSupplied;
-	}
-
-	public float getSupplyBarPercentage() {
-		return (getEnergyFromConsumingElemnets() > 0.001) ? (getEnergyFromNetwork()+ this.getEnergySelfSupplied())/getEnergyFromConsumingElemnets() : 1.0f;
-	}
-	public void setEnergySelfSupplied(float energySelfSupplied) {
-		this.energySelfSupplied = energySelfSupplied;
-	}
-	public class SupplierListEntry{
-		public Supplier supplier;
-		public float energyFromSupplier;
-		public SupplierListEntry(Supplier supplier,float energyFromSupplier) {
-			this.supplier = supplier;
-			this.energyFromSupplier = energyFromSupplier;
-		}
-	}
-
-}

+ 0 - 23
src/holeg/ui/model/DecoratedHolonObject.java

@@ -1,23 +0,0 @@
-package holeg.ui.model;
-
-import holeg.model.HolonObject;
-import holeg.model.HolonObject.HolonObjectState;
-
-public abstract class DecoratedHolonObject {
-
-	private HolonObject model;
-	private HolonObjectState state;
-	public DecoratedHolonObject(HolonObject objectToLookAt){
-		model = objectToLookAt;
-	}
-	abstract float getEnergy();
-	public HolonObject getModel() {
-		return model;
-	}
-	public HolonObjectState getState() {
-		return state;
-	}
-	public void setState(HolonObjectState state) {
-		this.state = state;
-	}
-}

+ 0 - 15
src/holeg/ui/model/Passiv.java

@@ -1,15 +0,0 @@
-package holeg.ui.model;
-
-import holeg.model.HolonObject;
-
-public class Passiv extends DecoratedHolonObject {
-	public Passiv(HolonObject objectToLookAt) {
-		super(objectToLookAt);
-	}
-	
-	@Override
-	float getEnergy() {
-		return 0;
-	}
-
-}

+ 0 - 65
src/holeg/ui/model/Supplier.java

@@ -1,65 +0,0 @@
-package holeg.ui.model;
-
-import java.util.ArrayList;
-
-import holeg.model.HolonObject;
-
-public class Supplier extends DecoratedHolonObject {
-
-	private ArrayList<ConsumerListEntry> consumerList = new ArrayList<ConsumerListEntry>();
-	private float energyToSupplyNetwork;
-	private float energySupplied;
-	private float energySelfConsuming;
-	public Supplier(HolonObject objectToLookAt, float energyToSupplyNetwork, float energySelfConsuming) {
-		super(objectToLookAt);
-		this.energyToSupplyNetwork = energyToSupplyNetwork;
-		energySupplied = 0.0f;
-		this.energySelfConsuming = energySelfConsuming;
-	}
-
-	@Override
-	float getEnergy() {
-		return energyToSupplyNetwork;
-	}
-
-	public ArrayList<ConsumerListEntry> getConsumerList() {
-		return consumerList;
-	}
-
-	public void setConsumerList(ArrayList<ConsumerListEntry> consumerList) {
-		this.consumerList = consumerList;
-	}
-
-	public float getEnergyToSupplyNetwork() {
-		return energyToSupplyNetwork;
-	}
-
-	
-	public float getEnergySelfConsuming() {
-		return energySelfConsuming;
-	}
-	
-	public float getEnergyProducing() {
-		return energyToSupplyNetwork + energySelfConsuming;
-	}
-	
-	public float getEnergySupplied() {
-		return energySupplied;
-	}
-
-	public void setEnergySupplied(float energySupplied) {
-		this.energySupplied = energySupplied;
-	}
-	public class ConsumerListEntry{
-		public Consumer consumer;
-		public float energyToConsumer;
-		public ConsumerListEntry(Consumer consumer, float energyToConsumer) {
-			this.consumer= consumer;
-			this.energyToConsumer = energyToConsumer;
-		}
-	}
-	@Override
-	public String toString() {
-		return getModel().getName();
-	}
-}