Search in sources :

Example 1 with ShiftOperation

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

Aggregations

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