use of org.grupolys.samulan.analyser.operation.ScopeStrategy in project uuusa by aghie.
the class RuleManager method parseWeightOperation.
private Operation parseWeightOperation(String operation, String form) {
WeightingOperation sucessor = null;
ScopeStrategy strategy;
float weightingValue = 0;
Pattern p = Pattern.compile("(\\(.*\\))");
Matcher m = p.matcher(operation);
m.find();
String[] parameters = m.group(1).replace("(", "").replace(")", "").split(",");
if (parameters[0].equals(SENTIDATA)) {
// System.out.println("form: "+form);
weightingValue = this.d.getValue(Operation.WEIGHT, form, true);
} else
weightingValue = Float.parseFloat(parameters[0]);
for (int i = parameters.length - 1; i >= 1; i--) {
strategy = getScopeStrategy(parameters[i], parameters);
sucessor = new WeightingOperation(null, strategy, weightingValue, sucessor);
}
return sucessor;
}
use of org.grupolys.samulan.analyser.operation.ScopeStrategy in project uuusa by aghie.
the class RuleManager method parseShiftOperation.
private Operation parseShiftOperation(String operation, String form) {
ShiftOperation successor = null;
ScopeStrategy strategy = null;
float shiftValue;
Pattern p = Pattern.compile("(\\(.*\\))");
Matcher m = p.matcher(operation);
m.find();
String[] parameters = m.group(1).replace("(", "").replace(")", "").split(",");
if (parameters[0].equals(SENTIDATA)) {
shiftValue = this.d.getValue(Operation.SHIFT, form, true);
} else
shiftValue = Float.parseFloat(parameters[0]);
for (int i = parameters.length - 1; i >= 0; i--) {
strategy = getScopeStrategy(parameters[i], parameters);
successor = new ShiftOperation(null, strategy, successor, shiftValue);
successor.setAlwaysShift(isAlwaysShift());
}
return successor;
}
Aggregations