- public void generateEnforce(PlanContext context, CodeWriter w, long location, Expression[] parameters) {
- throw new UnsupportedOperationException(getClass().getSimpleName() + " does not support enforce.");
+ public void generateIterate(PlanContext context, CodeWriter w, long location, int boundMask, Variable[] variables,
+ Expression[] expressions, Expression[] typeConstraintEvidenceParameters) {
+ Environment env = context.context.environment;
+ switch(boundMask) {
+ case BF:
+ context.iterateMaybe(location, w, variables[1],
+ w.apply(location,
+ env.getValue(POSSIBLE_RELATED_VALUE).getValue().createSpecialization(valueType),
+ typeConstraintEvidenceParameters[0].toVal(env, w),
+ expressions[0].toVal(env, w),
+ w.getModuleWriter().getExternalConstant(propertyRelation, Types.RESOURCE)));
+ break;
+ case BB:
+ context.checkEqualsJust(location, w, expressions[1].toVal(env, w),
+ w.apply(location,
+ env.getValue(POSSIBLE_RELATED_VALUE).getValue().createSpecialization(valueType),
+ typeConstraintEvidenceParameters[0].toVal(env, w),
+ expressions[0].toVal(env, w),
+ w.getModuleWriter().getExternalConstant(propertyRelation, Types.RESOURCE)));
+ break;
+ default: throw new IllegalArgumentException();
+ }