public CasesExhaustiveObligation(ACasesExp exp, IPOContextStack ctxt, IPogAssistantFactory assistantFactory) throws AnalysisException { super(exp, POType.CASES_EXHAUSTIVE, ctxt, exp.getLocation(), assistantFactory); PExp initialExp = alt2Exp(exp.getCases().getFirst(), exp, assistantFactory); List<ACaseAlternative> initialCases = new LinkedList<ACaseAlternative>(exp.getCases()); initialCases.remove(0); PExp pred = recOnExp(exp.clone(), initialCases, initialExp, assistantFactory); stitch = pred.clone(); valuetree.setPredicate(ctxt.getPredWithContext(pred)); }
public StateInvariantObligation(AClassInvariantDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.STATE_INV_INIT, ctxt, def.getLocation(), af); assistantFactory = af; // After instance variable initializers stitch = invDefs(def.getClassDefinition()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public StateInvariantObligation(AExplicitOperationDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.STATE_INV, ctxt, def.getLocation(), af); assistantFactory = af; // After def.getName() constructor body stitch = invDefs(def.getClassDefinition()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public MapInjectivityComp(PExp exp, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(exp, POType.MAP_INJ_COMP, ctxt, exp.getLocation(), af); stitch = buildPredicate(exp.clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public MapInjectivityComp(AMapCompMapExp exp, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(exp, POType.MAP_INJ_COMP, ctxt, exp.getLocation(), af); stitch = buildPredicate(exp.clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public NonEmptySetObligation(PExp exp, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(exp, POType.NON_EMPTY_SET, ctxt, exp.getLocation(), af); // exp <> {} ASetEnumSetExp setExp = new ASetEnumSetExp(); setExp.setMembers(new LinkedList<PExp>()); // empty list ANotEqualBinaryExp notEqualsExp = AstExpressionFactory.newANotEqualBinaryExp(exp.clone(), setExp); stitch = notEqualsExp; valuetree.setPredicate(ctxt.getPredWithContext(notEqualsExp)); } }
public SetMembershipObligation(PPattern pattern, PExp set, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(set, POType.SET_MEMBER, ctxt, set.getLocation(), af); AInSetBinaryExp inSetExp = AstExpressionFactory.newAInSetBinaryExp(patternToExp(pattern), set.clone()); stitch = inSetExp; valuetree.setPredicate(ctxt.getPredWithContext(inSetExp)); } }
public OrderedObligation(SBinaryExp node, List<PType> types, IPOContextStack ctxt,IPogAssistantFactory af) throws AnalysisException { super(node, POType.ORDERED,ctxt,node.getLocation(),af); PExp lExp = node.getLeft(); PExp rExp = node.getRight(); PExp r = stitchIsExps(types,lExp,rExp); valuetree.setPredicate(ctxt.getPredWithContext(r)); }
public OperationPostConditionObligation(AExplicitOperationDefinition op, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(op, POType.OP_POST_CONDITION, ctxt, op.getLocation(), af); PExp pred = buildExp(op.getPrecondition(), op.getPostcondition().clone(), null); stitch = pred; valuetree.setPredicate(ctxt.getPredWithContext(pred)); }
public NonZeroObligation(ILexLocation location, PExp exp, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(exp, POType.NON_ZERO, ctxt, location, af); // exp <> 0 AIntLiteralExp zeroExp = getIntLiteral(0); zeroExp.setType(new AIntNumericBasicType()); ANotEqualBinaryExp notEqualsExp = AstExpressionFactory.newANotEqualBinaryExp(exp.clone(), zeroExp); stitch = notEqualsExp; valuetree.setPredicate(ctxt.getPredWithContext(notEqualsExp)); } }
public RecursiveObligation(AExplicitFunctionDefinition def, AApplyExp apply, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(apply, POType.RECURSIVE, ctxt, apply.getLocation(), af); PExp measureLeft_exp = buildMeasureLeft(def, apply); PExp measureRight_exp = buildMeasureRight(def, apply); PExp lt_exp = buildStructuralComparison(measureLeft_exp, measureRight_exp, getLex(def.getMeasureDef())); stitch = lt_exp; valuetree.setPredicate(ctxt.getPredWithContext(lt_exp)); }
public RecursiveObligation(AImplicitFunctionDefinition def, AApplyExp apply, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.RECURSIVE, ctxt, apply.getLocation(), af); PExp measureLeft_exp = buildMeasureLeft(def, apply); PExp measureRight_exp = buildMeasureRight(def, apply); PExp lt_exp = buildStructuralComparison(measureLeft_exp, measureRight_exp, getLex(def.getMeasureDef())); stitch = lt_exp; valuetree.setPredicate(ctxt.getPredWithContext(lt_exp)); }
public SeqApplyObligation(PExp root, PExp arg, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(root, POType.SEQ_APPLY, ctxt, root.getLocation(), af); AIndicesUnaryExp indsExp = new AIndicesUnaryExp(); indsExp.setExp(root.clone()); AInSetBinaryExp inSetExp = AstExpressionFactory.newAInSetBinaryExp(arg.clone(), indsExp); stitch = inSetExp; valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public SeqMembershipObligation(PPattern pattern, PExp seq, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(seq, POType.SEQ_MEMBER, ctxt, seq.getLocation(), af); AElementsUnaryExp elems = AstFactory.newAElementsUnaryExp(seq.getLocation(), seq.clone()); AInSetBinaryExp inSetExp = AstExpressionFactory.newAInSetBinaryExp(patternToExp(pattern), elems); stitch = inSetExp; valuetree.setPredicate(ctxt.getPredWithContext(inSetExp)); } }
public OperationPostConditionObligation(AImplicitOperationDefinition op, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(op, POType.OP_POST_CONDITION, ctxt, op.getLocation(), af); stitch = buildExp(op.getPrecondition(), op.getPostcondition().clone(), op.clone().getErrors()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
private TypeCompatibilityObligation(AExplicitOperationDefinition def, PType actualResult, IPOContextStack ctxt, IPogAssistantFactory assistantFactory) throws AnalysisException { super(def, POType.TYPE_COMP, ctxt, def.getLocation(), assistantFactory); this.assistantFactory = assistantFactory; AVariableExp result = AstFactory.newAVariableExp(new LexNameToken(def.getName().getModule(), "RESULT", def.getLocation())); stitch = oneType(false, result, ((AOperationType) def.getType()).getResult().clone(), actualResult.clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public ParameterPatternObligation(AExplicitFunctionDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.FUNC_PATTERNS, ctxt, def.getLocation(), af); this.assistantFactory = af; // valuetree.setContext(ctxt.getContextNodeList()); // cannot clone getPredef as it can be null. We protect the ast in // the generate method where it's used stitch = generate(def.getPredef(), cloneListPatternList(def.getParamPatternList()), cloneListType(((AFunctionType) def.getType()).getParameters()), ((AFunctionType) def.getType()).getResult().clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public ParameterPatternObligation(AExplicitOperationDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.OPERATION_PATTERNS, ctxt, def.getLocation(), af); this.assistantFactory = af; stitch = generate(def.getPredef(), cloneListPatternList(assistantFactory.createAExplicitOperationDefinitionAssistant().getParamPatternList(def)), cloneListType(((AOperationType) def.getType()).getParameters()), ((AOperationType) def.getType()).getResult().clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public ParameterPatternObligation(AImplicitOperationDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.OPERATION_PATTERNS, ctxt, def.getLocation(), af); this.assistantFactory = af; stitch = generate(def.getPredef(), cloneListPatternList(assistantFactory.createAImplicitOperationDefinitionAssistant().getListParamPatternList(def)), cloneListType(((AOperationType) def.getType()).getParameters()), ((AOperationType) def.getType()).getResult().clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
public ParameterPatternObligation(AImplicitFunctionDefinition def, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(def, POType.FUNC_PATTERNS, ctxt, def.getLocation(), af); this.assistantFactory = af; stitch = generate(def.getPredef(), cloneListPatternList(assistantFactory.createAImplicitFunctionDefinitionAssistant().getParamPatternList(def)), cloneListType(((AFunctionType) def.getType()).getParameters()), ((AFunctionType) def.getType()).getResult().clone()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }