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