use of org.mvel2.integration.VariableResolver in project mvel by mikebrock.
the class IndexedOperativeAssign method getReducedValueAccelerated.
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
VariableResolver resolver = factory.getIndexedVariableResolver(register);
resolver.setValue(ctx = MathProcessor.doOperations(resolver.getValue(), operation, statement.getValue(ctx, thisValue, factory)));
return ctx;
}
use of org.mvel2.integration.VariableResolver in project mvel by mikebrock.
the class DefaultLocalVariableResolverFactory method createVariable.
public VariableResolver createVariable(String name, Object value, Class<?> type) {
if (indexedVariableNames == null)
return super.createVariable(name, value, type);
VariableResolver vr;
boolean newVar = false;
try {
int idx;
if ((idx = variableIndexOf(name)) != -1) {
vr = new SimpleValueResolver(value);
if (indexedVariableResolvers[idx] == null) {
indexedVariableResolvers[idx] = vr;
}
variableResolvers.put(indexedVariableNames[idx], vr);
vr = indexedVariableResolvers[idx];
newVar = true;
} else {
return super.createVariable(name, value, type);
}
} catch (UnresolveablePropertyException e) {
vr = null;
}
if (!newVar && vr != null && vr.getType() != null) {
throw new RuntimeException("variable already defined within scope: " + vr.getType() + " " + name);
} else {
addResolver(name, vr = new MapVariableResolver(variables, name, type)).setValue(value);
return vr;
}
}
use of org.mvel2.integration.VariableResolver in project mvel by mikebrock.
the class IndexedPostFixIncNode method getReducedValueAccelerated.
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
VariableResolver vResolver = factory.getIndexedVariableResolver(register);
vResolver.setValue(MathProcessor.doOperations(ctx = vResolver.getValue(), Operator.ADD, DataTypes.INTEGER, 1));
return ctx;
}
use of org.mvel2.integration.VariableResolver in project mvel by mikebrock.
the class IndexedPreFixDecNode method getReducedValueAccelerated.
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
VariableResolver vResolver = factory.getIndexedVariableResolver(register);
vResolver.setValue(ctx = MathProcessor.doOperations(vResolver.getValue(), Operator.SUB, DataTypes.INTEGER, 1));
return ctx;
}
use of org.mvel2.integration.VariableResolver in project mvel by mikebrock.
the class PostFixDecNode method getReducedValueAccelerated.
public Object getReducedValueAccelerated(Object ctx, Object thisValue, VariableResolverFactory factory) {
VariableResolver vResolver = factory.getVariableResolver(name);
vResolver.setValue(MathProcessor.doOperations(ctx = vResolver.getValue(), Operator.SUB, DataTypes.INTEGER, 1));
return ctx;
}
Aggregations