Fixed some stuff

This commit is contained in:
Daniel Poustka 2020-12-26 10:16:42 +01:00
parent 643bf23c0b
commit 22369d7b70
2 changed files with 21 additions and 22 deletions

View File

@ -25,14 +25,14 @@ public class NodeFactory
NodeBase n = null;
NodeType nodeType = null;
String subsChannels = "";
int startMoney = 0;
double startMoney = 0;
try
{
nodeType = NodeType.valueOf(input.getAttribute("type"));
subsChannels = input.getChild("subscribed_channels");
startMoney = Integer.getInteger(input.getChild("money"));
startMoney = Double.parseDouble(input.getChild("money"));
}
catch (IllegalArgumentException e)
{
@ -43,25 +43,25 @@ public class NodeFactory
System.err.println("! Fatal error in NodeFactory: " + e.getMessage());
}
// switch (Objects.requireNonNull(nodeType))
// {
// //TODO Money constructor
// case Farmer:
// n = new Farmer(startMoney);
// break;
// case Processor:
// n = new Processor(startMoney);
// break;
// case Distributor:
// n = new Distributor(startMoney);
// break;
// case Seller:
// n = new Seller(startMoney);
// break;
// case Customer:
// n = new Customer(startMoney);
// break;
// }
switch (Objects.requireNonNull(nodeType))
{
//TODO Money constructor
case Farmer:
n = new Farmer(startMoney);
break;
case Processor:
n = new Processor(startMoney);
break;
case Distributor:
n = new Distributor(startMoney);
break;
case Seller:
n = new Seller(startMoney);
break;
case Customer:
n = new Customer(startMoney);
break;
}
String[] subs = subsChannels.split(";");
//todo Node subscription to channels by parser data

View File

@ -27,7 +27,6 @@ public class Product
this.money = Monetary.getDefaultAmountFactory().setCurrency("USD").setNumber(0).create();
}
//TODO money int constructor
public Product(String name, ProductType productType, Double money)
{
this.name = name;