public SatisfiabilityObligation(
      AStateDefinition node, IPOContextStack ctxt, IPogAssistantFactory af)
      throws AnalysisException {
    super(node, POType.STATE_INV_SAT, ctxt, node.getLocation(), af);

    AExistsExp exists_exp = new AExistsExp();
    exists_exp.setType(new ABooleanBasicType());
    List<PMultipleBind> binds = getInvBinds(node);

    exists_exp.setBindList(binds);
    exists_exp.setPredicate(node.getInvExpression().clone());

    stitch = exists_exp;
    valuetree.setPredicate(ctxt.getPredWithContext(exists_exp));
  }
  protected void stateInPost(
      List<PMultipleBind> exists_binds, List<PExp> postArglist, PDefinition stateDefinition) {

    AVariableExp varExp;
    // replace with super call
    if (stateDefinition instanceof AStateDefinition) {
      varExp = getVarExp(NEW_STATE_ARG);
      AStateDefinition aStateDefinition = (AStateDefinition) stateDefinition;
      varExp.setType(aStateDefinition.getRecordType().clone());
      exists_binds.addAll(
          getMultipleTypeBindList(aStateDefinition.getRecordType().clone(), NEW_STATE_ARG));
    } else {
      varExp = getVarExp(NEW_SELF_ARG);
      varExp.setType(stateDefinition.getType().clone());
      exists_binds.addAll(getMultipleTypeBindList(stateDefinition.getType().clone(), NEW_SELF_ARG));
    }
    postArglist.add(varExp);
  }
  private List<PMultipleBind> getInvBinds(AStateDefinition node) {
    List<PMultipleBind> r = new Vector<PMultipleBind>();

    for (AFieldField f : node.getFields()) {
      r.add(getMultipleTypeBind(f.getType().clone(), f.getTagname().clone()));
    }

    return r;
  }
Exemplo n.º 4
0
 @Override
 public List<PDefinition> caseAStateDefinition(AStateDefinition node) throws AnalysisException {
   return node.getStateDefs();
 }