use of org.grupolys.samulan.analyser.operation.FirstSubjectiveChildrenStrategy in project uuusa by aghie.
the class RuleManager method getOperations.
/**
* @param dg
* @param address
* @return
*/
public List<Operation> getOperations(SentimentDependencyGraph dg, short address) {
SentimentDependencyNode currentNode = dg.getNode(address);
List<Operation> operations = new ArrayList<Operation>();
for (Rule r : rules) {
if (r.match(dg, currentNode)) {
Operation o = r.getOperation();
// System.out.println("currentNode: "+currentNode+" r: "+r+" o: "+o);
if (dg.getNode(address).getSi() == null)
dg.getNode(address).setSi(new SentimentInformation());
if (!o.getOperationName().equals(Operation.DEFAULT)) {
dg.getNode(address).getSi().setType(o.getOperationName());
if (o.getStrategy() instanceof NChildrenStrategy) {
((NChildrenStrategy) o.getStrategy()).setReference(address);
}
if (o.getStrategy() instanceof FirstSubjectiveChildrenStrategy) {
((FirstSubjectiveChildrenStrategy) o.getStrategy()).setReference(address);
}
}
operations.add(r.getOperation());
}
}
if (operations.contains(getOperation(Operation.DEFAULT)) && operations.size() > 1)
operations.remove(getOperation(Operation.DEFAULT));
return operations;
}
Aggregations