Package edu.cmu.cs.fusion.constraint.predicates

Examples of edu.cmu.cs.fusion.constraint.predicates.TruePredicate


          parser.reset(node.getTextContent());
          effects.add(parser.effect());
        }
      }
      if (trigger == null)
        trigger = new TruePredicate();
      if (restrict == null)
        restrict = new TruePredicate();
      if (requires == null)
        requires = new TruePredicate();
     
      constraints.add(new Constraint(resource.getName(), op, trigger, restrict, requires, effects));
    } catch (ParseException e) {
      ReportingUtility.reportParseError(resource, null, e.getMessage());
    }
View Full Code Here


        opParams[ndx] = new SpecVar(method.getParameterNames()[ndx]);
      }
      op = new MethodInvocationOp(methodName, receiverType, opParams, paramTypes, returnType, isStatic);
    }
    String owner = method.getDeclaringType().getFullyQualifiedName();
    constraints.add(new Constraint(owner, op, new TruePredicate(), new TruePredicate(), new TruePredicate(), effects));
  }
View Full Code Here

    Operation op = new BeginOfMethodOp(declaringType.getFullyQualifiedName(), methodType.getElementName(), params, paramTypes, isStatic);
    List<Effect> effects = new LinkedList<Effect>();
    effects.add(RelEffect.createAddEffect(relation, new SpecVar[] {Constraint.RECEIVER}));
   
    String owner = methodType.getDeclaringType().getFullyQualifiedName();
    constraints.add(new Constraint(owner, op, new TruePredicate(), new TruePredicate(), new TruePredicate(), effects));
  }
View Full Code Here

    Predicate rst;
   
    op = new MethodInvocationOp("methodName", "Foo", new SpecVar[] {utils.getVar(0), utils.getVar(1)}, new String[] {"Foo", "Bar"}, "Bar", false);
    trigger = new RelationshipPredicate(utils.getRelation(0), new SpecVar[] {utils.getVar(0), utils.getVar(1)});
    rst = new RelationshipPredicate(utils.getRelation(1), new SpecVar[] {utils.getVar(1), utils.getVar(2)});
    cons = new Constraint("", op, trigger, rst, new TruePredicate(), new LinkedList<Effect>());
   
   
    labels = new ObjectLabel[7];
    labels[0] = new AbstractObjectLabel("0", "Foo");
    labels[1] = new AbstractObjectLabel("1", "Bar");
View Full Code Here

  }
 
  @Test
  public void testTrueNoSubs() throws FusionException {
    Predicate rst = new RelationshipPredicate(new Relation("D", new String[] {"Bar", "NewType"}), new SpecVar[] {utils.getVar(1), utils.getVar(2)});
    Constraint noSubCons = new Constraint("", cons.getOp(), cons.getTrigger(), rst, new TruePredicate(), new LinkedList<Effect>());
 
    RelationshipDelta startRels = new RelationshipDelta();
    startRels.setRelationship(new Relationship(utils.getRelation(0), new ObjectLabel[]{labels[0], labels[1]}), SevenPointLattice.TRU);
    RelationshipContext rels = new RelationshipContext(false).applyChangesFromDelta(startRels);
View Full Code Here

    Predicate trigger;
    Predicate req;
    List<Effect> effects = new LinkedList<Effect>();
   
    op = new MethodInvocationOp("methodName", "Foo", new SpecVar[] {utils.getVar(0)}, new String[] {"Bar"}, "Foo", false);
    trigger = new TruePredicate();
    req = new TruePredicate();
    effects.add(RelEffect.createRemoveEffect(utils.getRelation(0), new SpecVar[] {Constraint.RECEIVER, utils.getVar(0)}));
    effects.add(RelEffect.createAddEffect(utils.getRelation(0), new SpecVar[] {Constraint.RESULT, utils.getVar(0)}));
   
    cons = new Constraint("", op, trigger, new TruePredicate(), req, effects);
   
    labels = new ObjectLabel[7];
    labels[0] = new AbstractObjectLabel("0", "Foo");
    labels[1] = new AbstractObjectLabel("1", "Bar");
    labels[2] = new AbstractObjectLabel("2", "Baz");
View Full Code Here

    Operation op = new ConstructorOp("Foo", new SpecVar[] {utils.getVar(0)}, new String[] {"Bar"});
    List<Effect> effects = new LinkedList<Effect>();
    effects.add(RelEffect.createRemoveEffect(utils.getRelation(1), new SpecVar[] {utils.getVar(0), utils.getVar(0)}));
    effects.add(RelEffect.createAddEffect(utils.getRelation(0), new SpecVar[] {Constraint.RESULT, utils.getVar(0)}));
   
    Constraint cons = new Constraint("", op, new TruePredicate(), new TruePredicate(), new TruePredicate(), effects);

    FusionEnvironment<?> env = new FusionEnvironment<TestAliasContext>(aliases, rels, null, types, new InferenceEnvironment(null), variant);   
    Pair<RelationshipDelta, AliasDelta> deltas = runSingleConstraint(env, cons, instr);
    FusionErrorReport error = checkSingleConstraint(env, cons, instr);
    Relationship eff1 = new Relationship(utils.getRelation(1), new ObjectLabel[]{labels[5], labels[5]});
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.constraint.predicates.TruePredicate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.