jif.types
Class LabelConstraint

java.lang.Object
  extended by jif.types.Constraint
      extended by jif.types.LabelConstraint

public class LabelConstraint
extends Constraint

A LabelConstraint represents a constraint on labels, which may either be an inequality or equality constraint. LabelConstraints are generated during type checking. LabelConstraints in turn produce Equations which are what the Solver will use to find a satisfying assignment for Variables.


Nested Class Summary
 
Nested classes/interfaces inherited from class jif.types.Constraint
Constraint.Kind
 
Field Summary
static Constraint.Kind EQUAL
          An equality kind of constraint.
static Constraint.Kind LEQ
          An inequality kind of constraint.
protected  NamedLabel namedLHS
          Names for the LHS
protected  NamedLabel namedRHS
          Names for the RHS
 
Fields inherited from class jif.types.Constraint
env, kind, lhs, messages, pos, report, rhs
 
Constructor Summary
LabelConstraint(NamedLabel lhs, Constraint.Kind kind, NamedLabel rhs, LabelEnv env, polyglot.util.Position pos, ConstraintMessage msg, boolean report)
           
 
Method Summary
protected  void addLEQEqns(java.util.Collection eqns, Label left, Label right)
          Produce equations that require left to be less than or equal to right, and add them to eqns.
 java.util.Map definitions(VarMap bounds)
          Returns a Map of Strings to List[String]s which is the definitions/bounds of the NamedLabels, and the description of any components that appear in the NamedLabels.
 java.util.Collection getEquations()
          Produce a Collection of Equations for this constraint.
 boolean hasVariables()
           
 Label lhsLabel()
           
protected  java.util.Map namedDescrips()
          Return a map from Strings to Strings, which are the descriptions of names in the left and right hand sides.
protected  java.util.Map namedLabels()
          Return a map from Strings to Labels, which are the named elements of the left and right hand sides.
 NamedLabel namedLhs()
           
 NamedLabel namedRhs()
           
 Label rhsLabel()
           
 
Methods inherited from class jif.types.Constraint
detailMsg, env, isCanonical, kind, messages, msg, position, report, technicalMsg, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EQUAL

public static final Constraint.Kind EQUAL
An equality kind of constraint. That is, the constraint requires that lhs <= rhs and rhs <= lhs.


LEQ

public static final Constraint.Kind LEQ
An inequality kind of constraint. That is, the constraint requires that lhs <= rhs.


namedLHS

protected NamedLabel namedLHS
Names for the LHS


namedRHS

protected NamedLabel namedRHS
Names for the RHS

Constructor Detail

LabelConstraint

public LabelConstraint(NamedLabel lhs,
                       Constraint.Kind kind,
                       NamedLabel rhs,
                       LabelEnv env,
                       polyglot.util.Position pos,
                       ConstraintMessage msg,
                       boolean report)
Method Detail

lhsLabel

public Label lhsLabel()

rhsLabel

public Label rhsLabel()

namedLhs

public NamedLabel namedLhs()

namedRhs

public NamedLabel namedRhs()

namedLabels

protected java.util.Map namedLabels()
Return a map from Strings to Labels, which are the named elements of the left and right hand sides.


namedDescrips

protected java.util.Map namedDescrips()
Return a map from Strings to Strings, which are the descriptions of names in the left and right hand sides.


definitions

public java.util.Map definitions(VarMap bounds)
Returns a Map of Strings to List[String]s which is the definitions/bounds of the NamedLabels, and the description of any components that appear in the NamedLabels. This map is used for verbose output to the user, to help explain the meaning of this constraint.


getEquations

public java.util.Collection getEquations()
Produce a Collection of Equations for this constraint.

Specified by:
getEquations in class Constraint

addLEQEqns

protected void addLEQEqns(java.util.Collection eqns,
                          Label left,
                          Label right)
Produce equations that require left to be less than or equal to right, and add them to eqns.


hasVariables

public boolean hasVariables()
Specified by:
hasVariables in class Constraint