Search in sources :

Example 1 with WeightingOperation

use of org.grupolys.samulan.analyser.operation.WeightingOperation 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;
}
Also used : Pattern(java.util.regex.Pattern) WeightingOperation(org.grupolys.samulan.analyser.operation.WeightingOperation) ScopeStrategy(org.grupolys.samulan.analyser.operation.ScopeStrategy) Matcher(java.util.regex.Matcher)

Aggregations

Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 ScopeStrategy (org.grupolys.samulan.analyser.operation.ScopeStrategy)1 WeightingOperation (org.grupolys.samulan.analyser.operation.WeightingOperation)1