Package edu.cmu.cs.fusion

Examples of edu.cmu.cs.fusion.ThreeValue


  public FreeVars getFreeVariables() {
    return new FreeVars().addVar(value, FreeVars.BOOL_TYPE);
  }

  public ThreeValue getTruth(FusionEnvironment env, Substitution sub) {
    ThreeValue val = env.getBooleanValue(sub.getSub(value));
    return isPositive ? val : val.negate();
  }
View Full Code Here


   
    List<Substitution> failingSubs = new LinkedList<Substitution>();   
   
    boolean hasGoodSub = false;
    for (Substitution sub : subs) {
      ThreeValue trigger = cons.getTrigger().getTruth(triggerEnv, sub);
      if (isGoodSubs(trigger, triggerEnv, sub, cons)) {     
        if (checkFullyBound(triggerEnv, sub, cons))
          failingSubs.add(sub);
        hasGoodSub = true;
      }
View Full Code Here

   * @param cons The constraint to check
   * @param instr The instruction to report errors on
   * @return Any change effects
   */
  protected Pair<RelationshipDelta, Substitution> runFullyBound(FusionEnvironment<?> env, Substitution partialSubs, Constraint cons) { 
    ThreeValue trigger = cons.getTrigger().getTruth(env, partialSubs);
    Substitution keepSub = isGoodSubs(trigger, env, partialSubs, cons) ? partialSubs : null;
    RelationshipDelta delta;
   
    if (trigger == ThreeValue.FALSE) {
      delta = RelationshipDelta.getTrueBottom();
View Full Code Here

      if (cons.getRestrict() instanceof TruePredicate)
        return true;
      List<Substitution> subs = env.allValidSubs(partialSubs, cons.getFreeVars());
       
      for (Substitution sub : subs) {
        ThreeValue restrict = cons.getRestrict().getTruth(env, sub);
       
        if ((restrict == ThreeValue.TRUE) || (restrict == ThreeValue.UNKNOWN && !variant.isPragmatic()))
          return true;
      }
      return false;
View Full Code Here

   * @param partialSubs
   * @param cons
   * @return True if there is an error, false if there is not an error
   */
  protected boolean checkFullyBound(FusionEnvironment<?> triggerEnv, Substitution partialSubs, Constraint cons) {     
    ThreeValue trigger = cons.getTrigger().getTruth(triggerEnv, partialSubs);
   
    if (trigger == ThreeValue.FALSE)
      return false;
    else if (trigger == ThreeValue.UNKNOWN){
      if (variant.isComplete() || variant.isPragmatic())
View Full Code Here

  private boolean checkPragmatically(FusionEnvironment<?> env,
      Substitution partialSubs, Constraint cons) {   
    List<Substitution> subs = env.allValidSubs(partialSubs, cons.getFreeVars());
   
    for (Substitution fullSub : subs) {
      ThreeValue req = cons.getRequires().getTruth(env, fullSub);
      if (req == ThreeValue.TRUE)
        return false;
    }
    return true;
  }
View Full Code Here

   
    if (subs.isEmpty())
      return true;
   
    for (Substitution fullSub : subs) {
      ThreeValue req = cons.getRequires().getTruth(env, fullSub);
      if (req != ThreeValue.TRUE)
        return true;
    }
    return false;
  }
View Full Code Here

  private boolean checkCompletely(FusionEnvironment<?> env,
      Substitution partialSubs, Constraint cons) {
    List<Substitution> subs = env.allValidSubs(partialSubs, cons.getFreeVars());
   
    for (Substitution fullSub : subs) {
      ThreeValue req = cons.getRequires().getTruth(env, fullSub);
      if (req != ThreeValue.FALSE)
        return false;
    }
    return true;
  }
View Full Code Here

  public ImpliesPredicate(Predicate left, Predicate right) {
    super(left, right);
  }

  public ThreeValue getTruth(FusionEnvironment env, Substitution sub) {
    ThreeValue lTV = lhs.getTruth(env, sub);
   
    if (lTV == ThreeValue.TRUE)
      return rhs.getTruth(env, sub);
    else if (lTV == ThreeValue.FALSE)
      return ThreeValue.TRUE;
View Full Code Here

    for (int ndx = 0; ndx < vars.length; ndx++) {
      objLabels[ndx] = sub.getSub(vars[ndx]);
    }
   
    Relationship rel = new Relationship(type, objLabels);
    ThreeValue val = env.getContext().getRelationship(rel);
   
    if (val == ThreeValue.UNKNOWN) {
      RelationshipDelta delta = env.getInferredDelta(this, sub);
     
      if (delta != null) {
        RelationshipContext newContext = env.getContext().applyChangesFromDelta(delta);
        FusionEnvironment newEnv = env.copy(newContext);
        val = getTruth(newEnv, sub);
      }
    }
   
    return isPositive ? val : val.negate();
  }
View Full Code Here

TOP

Related Classes of edu.cmu.cs.fusion.ThreeValue

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.