[Draft] Work on visitors (need some renovation)
This commit is contained in:
parent
3118f91a42
commit
fadc4732a9
@ -18,7 +18,6 @@ pass
|
||||
<scenario type="Farmer">
|
||||
<steps>
|
||||
generate
|
||||
pass
|
||||
sell FRUIT jablko
|
||||
</steps>
|
||||
</scenario>
|
||||
|
||||
@ -7,6 +7,7 @@ import cz.cvut.fel.sit.omo.foodchain.parser.ConfigurationParser;
|
||||
import cz.cvut.fel.sit.omo.foodchain.parser.ParserResult;
|
||||
import cz.cvut.fel.sit.omo.foodchain.parser.ParserResultElement;
|
||||
import cz.cvut.fel.sit.omo.foodchain.product.Product;
|
||||
import cz.cvut.fel.sit.omo.foodchain.reporting.ReportingManager;
|
||||
import cz.cvut.fel.sit.omo.foodchain.scenario.Scenario;
|
||||
import cz.cvut.fel.sit.omo.foodchain.util.Ticker;
|
||||
import org.xml.sax.SAXException;
|
||||
@ -34,6 +35,10 @@ public class FoodChain
|
||||
|
||||
Ticker.start();
|
||||
while (Ticker.getTimer().isRunning());
|
||||
|
||||
ReportingManager reportingManager = new ReportingManager();
|
||||
|
||||
System.out.println(reportingManager.acceptAllObjects());
|
||||
}
|
||||
|
||||
public static FactoryManager getFactoryManager()
|
||||
|
||||
@ -205,6 +205,10 @@ public class NodeBase implements ChannelObserver {
|
||||
return money;
|
||||
}
|
||||
|
||||
public NodeType getNodeType() {
|
||||
return nodeType;
|
||||
}
|
||||
|
||||
public Map<ChannelBase, ChannelSubscriptionType> getSubscribedChannels() {
|
||||
return subscribedChannels;
|
||||
}
|
||||
|
||||
@ -11,32 +11,33 @@ import cz.cvut.fel.sit.omo.foodchain.product.Product;
|
||||
public class ReportTextVisitor {
|
||||
private static final String ln = System.lineSeparator();
|
||||
|
||||
public String visit(NodeBase node){
|
||||
public String visit(NodeBase node) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append("Node info: ").append(ln)
|
||||
.append("Allowed seller: ").append(node.getAllowedSeller()).append(ln)
|
||||
.append("Allowed purchaser: ").append(node.getAllowedPurchaser()).append(ln)
|
||||
.append("Money: ").append(node.getMoney()).append(ln)
|
||||
.append("Refused transactions: ");
|
||||
result.append("Node type: ").append(node.getNodeType()).append(ln)
|
||||
.append("Allowed seller: ").append(node.getAllowedSeller()).append(ln)
|
||||
.append("Allowed purchaser: ").append(node.getAllowedPurchaser()).append(ln)
|
||||
.append("Money: ").append(node.getMoney()).append(ln)
|
||||
.append("Refused transactions: ");
|
||||
node.getRefusedTransactions().forEach(tr -> result.append(tr.accept(this)));
|
||||
result.append(ln).append(ln);
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public String visit(ChannelBase channel){
|
||||
public String visit(ChannelBase channel) {
|
||||
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
|
||||
public String visit(Product product){
|
||||
return null;
|
||||
public String visit(Product product) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String visit(ProductTransaction transaction){
|
||||
return null;
|
||||
public String visit(ProductTransaction transaction) {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String visit(FinancialTransaction transaction){
|
||||
return null;
|
||||
public String visit(FinancialTransaction transaction) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user