use of com.sri.ai.util.collect.StackedHashMap in project aic-expresso by aic-sri-international.
the class AbstractIterativeMultiIndexQuantifierElimination method extendAssignments.
/**
* Sets the value assignment to a given expression in the binding mechanism stored in the context.
* @param newAssignment
* @param context
* @return
*/
public static Context extendAssignments(Map<Expression, Expression> newAssignments, Context context) {
@SuppressWarnings("unchecked") Map<Expression, Expression> assignments = (Map<Expression, Expression>) context.getGlobalObject(ASSIGNMENTS_GLOBAL_OBJECTS_KEY);
Map<Expression, Expression> extendedAssignments;
if (assignments == null) {
extendedAssignments = newAssignments;
} else {
extendedAssignments = new StackedHashMap<>(newAssignments, assignments);
}
Context result = context.putGlobalObject(ASSIGNMENTS_GLOBAL_OBJECTS_KEY, extendedAssignments);
return result;
}
use of com.sri.ai.util.collect.StackedHashMap in project aic-expresso by aic-sri-international.
the class Assignment method extendAssignments.
/**
* Sets the value assignment to a given expression in the binding mechanism stored in the context.
* @param newAssignment
* @param context
* @return
*/
public static Context extendAssignments(Map<Expression, Expression> newAssignments, Context context) {
@SuppressWarnings("unchecked") Map<Expression, Expression> assignments = (Map<Expression, Expression>) context.getGlobalObject(ContextAssignmentLookup.ASSIGNMENTS_GLOBAL_OBJECTS_KEY);
Map<Expression, Expression> extendedAssignments;
if (assignments == null) {
extendedAssignments = newAssignments;
} else {
extendedAssignments = new StackedHashMap<>(newAssignments, assignments);
}
Context result = ContextAssignmentLookup.setAssignments(context, extendedAssignments);
return result;
}
Aggregations