@SuppressWarnings({ "rawtypes" })
@Override
public void execute(RuleMatch match, RuleElement element, RutaStream stream,
InferenceCrowd crowd) {
RutaStatement parent = element.getParent();
List list = parent.getEnvironment().getVariableValue(var, List.class);
List<Object> toRemove = new ArrayList<Object>();
for (Object entry : list) {
Object value1 = getValue(entry, parent);
for (RutaExpression arg : elements) {
if(arg instanceof ListExpression) {
ListExpression l = (ListExpression) arg;
List list2 = l.getList(parent);
for (Object object : list2) {
Object value2 = getValue(object, parent);
if(value1.equals(value2)) {
toRemove.add(entry);
}
}
} else {
Object value2 = getValue(arg, parent);
if(value1.equals(value2)) {
toRemove.add(entry);
}
}
}
}
for (Object object : toRemove) {
list.remove(object);
}
parent.getEnvironment().setVariableValue(var, list);
}