|
@@ -83,43 +83,47 @@ public class DecoratedGroupNode {
|
|
|
|
|
|
//Gather Informations:
|
|
|
public int getAmountOfSupplier() {
|
|
|
- return supplierList.size() + groupNodeList.stream().map(groupNode -> groupNode.getAmountOfSupplier()).reduce(0, (a,b)->a+b);
|
|
|
+ return supplierList.size() + groupNodeList.stream().map(groupNode -> groupNode.getAmountOfSupplier()).reduce(0, Integer::sum);
|
|
|
}
|
|
|
public int getAmountOfConsumer() {
|
|
|
- return consumerList.size() + groupNodeList.stream().map(groupNode -> groupNode.getAmountOfConsumer()).reduce(0, (a,b)->a+b);
|
|
|
+ return consumerList.size() + groupNodeList.stream().map(groupNode -> groupNode.getAmountOfConsumer()).reduce(0,Integer::sum);
|
|
|
}
|
|
|
public int getAmountOfPassiv() {
|
|
|
- return passivList.size() + groupNodeList.stream().map(groupNode -> groupNode.getAmountOfPassiv()).reduce(0, (a,b)->a+b);
|
|
|
+ return passivList.size() + groupNodeList.stream().map(groupNode -> groupNode.getAmountOfPassiv()).reduce(0, Integer::sum);
|
|
|
}
|
|
|
|
|
|
public int getAmountOfConsumerWithState(HolonObjectState state) {
|
|
|
- return ((int) consumerList.stream().map(con -> con.getState()).filter(rightState -> (rightState == state)).count()) + groupNodeList.stream().map(groupNode -> groupNode.getAmountOfConsumerWithState(state)).reduce(0, (a,b)->a+b);
|
|
|
+ return ((int) consumerList.stream().map(con -> con.getState()).filter(rightState -> (rightState == state)).count()) + groupNodeList.stream().map(groupNode -> groupNode.getAmountOfConsumerWithState(state)).reduce(0, Integer::sum);
|
|
|
}
|
|
|
|
|
|
public int getAmountOfElemntsFromHolonObjects() {
|
|
|
- return passivList.stream().map(object -> object.getModel().getElements().size()).reduce(0, (a, b) -> a + b)+
|
|
|
- supplierList.stream().map(object -> object.getModel().getElements().size()).reduce(0, (a, b) -> a + b)+
|
|
|
- consumerList.stream().map(object -> object.getModel().getElements().size()).reduce(0, (a, b) -> a + b)+
|
|
|
- groupNodeList.stream().map(groupNode -> groupNode.getAmountOfElemntsFromHolonObjects()).reduce(0, (a,b)->a+b);
|
|
|
+ return passivList.stream().map(object -> object.getModel().getElements().size()).reduce(0, Integer::sum)+
|
|
|
+ supplierList.stream().map(object -> object.getModel().getElements().size()).reduce(0, Integer::sum)+
|
|
|
+ consumerList.stream().map(object -> object.getModel().getElements().size()).reduce(0, Integer::sum)+
|
|
|
+ groupNodeList.stream().map(groupNode -> groupNode.getAmountOfElemntsFromHolonObjects()).reduce(0, Integer::sum);
|
|
|
}
|
|
|
|
|
|
public int getAmountOfAktiveElemntsFromHolonObjects() {
|
|
|
- return passivList.stream().map(object -> object.getModel().getNumberOfActiveElements()).reduce(0, (a, b) -> a + b)+
|
|
|
- supplierList.stream().map(object -> object.getModel().getNumberOfActiveElements()).reduce(0, (a, b) -> a + b)+
|
|
|
- consumerList.stream().map(object -> object.getModel().getNumberOfActiveElements()).reduce(0, (a, b) -> a + b)+
|
|
|
- groupNodeList.stream().map(groupNode -> groupNode.getAmountOfAktiveElemntsFromHolonObjects()).reduce(0, (a,b)->a+b);
|
|
|
+ return passivList.stream().map(object -> object.getModel().getNumberOfActiveElements()).reduce(0, Integer::sum)+
|
|
|
+ supplierList.stream().map(object -> object.getModel().getNumberOfActiveElements()).reduce(0, Integer::sum)+
|
|
|
+ consumerList.stream().map(object -> object.getModel().getNumberOfActiveElements()).reduce(0, Integer::sum)+
|
|
|
+ groupNodeList.stream().map(groupNode -> groupNode.getAmountOfAktiveElemntsFromHolonObjects()).reduce(0, Integer::sum);
|
|
|
}
|
|
|
public float getConsumptionFromConsumer() {
|
|
|
- return consumerList.stream().map(con -> con.getEnergyNeededFromNetwork()).reduce(0.f, (a, b) -> a + b)+
|
|
|
- groupNodeList.stream().map(groupNode -> groupNode.getConsumptionFromConsumer()).reduce(0.f, (a,b)->a+b);
|
|
|
+ return consumerList.stream().map(con -> con.getEnergyNeededFromNetwork()).reduce(0.f, Float::sum)+
|
|
|
+ groupNodeList.stream().map(groupNode -> groupNode.getConsumptionFromConsumer()).reduce(0.f, Float::sum);
|
|
|
}
|
|
|
public float getProductionFromSupplier() {
|
|
|
- return supplierList.stream().map(sup -> sup.getEnergyToSupplyNetwork()).reduce(0.f, (a, b) -> a + b)+
|
|
|
- groupNodeList.stream().map(groupNode -> groupNode.getProductionFromSupplier()).reduce(0.f, (a,b)->a+b);
|
|
|
+ return supplierList.stream().map(sup -> sup.getEnergyToSupplyNetwork()).reduce(0.f, Float::sum)+
|
|
|
+ groupNodeList.stream().map(groupNode -> groupNode.getProductionFromSupplier()).reduce(0.f, Float::sum);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+ public float getAverageConsumption() {
|
|
|
+ return getConsumptionFromConsumer() / (float)getAmountOfHolons();
|
|
|
+ }
|
|
|
+ public float getAverageProduction() {
|
|
|
+ return getProductionFromSupplier() / (float)getAmountOfHolons();
|
|
|
+ }
|
|
|
|
|
|
|
|
|
public String toString() {
|