jif.types
Interface Label

All Superinterfaces:
java.lang.Cloneable, polyglot.util.Copy, Param, java.io.Serializable, polyglot.types.TypeObject
All Known Subinterfaces:
ArgLabel, CovariantLabel, DynamicArgLabel, DynamicLabel, DynrecLabel, JoinLabel, LabelOfVar, MeetLabel, NotTaken, ParamLabel, PolicyLabel, RuntimeLabel, TopLabel, UnknownLabel, VarLabel
All Known Implementing Classes:
ArgLabel_c, CovariantLabel_c, DynamicArgLabel_c, DynamicLabel_c, DynrecLabel_c, JoinLabel_c, Label_c, LabelOfVar_c, MeetLabel_c, NotTaken_c, ParamLabel_c, PolicyLabel_c, RuntimeLabel_c, TopLabel_c, UnknownLabel_c, VarLabel_c

public interface Label
extends Param

This class represents the Jif security label.


Method Summary
 Label bound(VarMap ub, java.util.Set visited)
          Gets the upper bound of this label.
 java.util.Collection components()
          Retrieve the collection of components.
 java.lang.String componentString()
           
 java.lang.String description()
           
 Label description(java.lang.String d)
           
 Label fold(UID uid)
          Substitutes any occurences of for .
 boolean hasVariables()
          Does this label (or any of its components) contain any label variables?
 boolean isBottom()
          Is this label equivalent to bottom?
 boolean isComparable()
          Is this label comparable to other labels?
 boolean isCovariant()
          Is this label covariant?
 boolean isEnumerable()
          Are the components of this label enumerable?
 boolean isInvariant()
          Is this label invariant?
 boolean isMeetable()
          Can this label be used in a meet operation with another label?
 boolean isSingleton()
          Does this label represent only a single label?
 boolean isTop()
          Is this label equivalent to top?
 Label join(Label L)
          Returns the join of this label and L.
 Label join(Label L, PrincipalHierarchy ph)
          Returns the join of this label and L, and simplifies it, based on the given PrincipalHierarchy
 Label labelOf()
          Gets labelOf this label.
 boolean leq_(Label L)
           
 boolean leq_(Label L, LabelEnv env)
          Implementation of leq, should only be called by JifTypeSystem
 Label meet_(Label L, PrincipalHierarchy ph)
          Implementation of the meet operation, should only be called by JifTypeSystem
 Label meet(Label L)
          Returns the meet of this label and L.
 Label meet(Label L, PrincipalHierarchy ph)
          Returns the meet of this label and L, and simplifies it, based on the given PrincipalHierarchy
 Label minus(Label L)
          Returns a copy of this Label, with the Label L removed from the components.
 Label simplify()
          Returns a simplified copy of this Label.
 Label singletonComponent()
          Retrieve the singleton component that this label represents.
 Label subst(LabelSubstitution substitution)
          Accepts a LabelSubstitution and returns the result of substituting according to the given LabelSubstitution.
 Label subst(UID uid, Label L)
          Substitutes any occurences of for L.
 polyglot.ast.Expr toJava(JifToJavaRewriter rw)
           
 void translate(polyglot.types.Resolver c, polyglot.util.CodeWriter w)
           
 java.util.Collection variables()
          The collection of variables contained by this label (or any of its components).
 
Methods inherited from interface jif.types.Param
isCanonical, isRuntimeRepresentable
 
Methods inherited from interface polyglot.types.TypeObject
equalsImpl, position, typeSystem
 
Methods inherited from interface polyglot.util.Copy
copy
 

Method Detail

bound

public Label bound(VarMap ub,
                   java.util.Set visited)
Gets the upper bound of this label.

Parameters:
ub - the upper bound map for variable labels
visited - the set of UIDs visited. if the upper bound is <dynamic uid...>,
  • if uid is contained in visited, will be returned;
  • otherwise, uid is added into visited.

isBottom

public boolean isBottom()
Is this label equivalent to bottom?

For example, a JoinLabel with no components would return true for this method.


isTop

public boolean isTop()
Is this label equivalent to top?

For example, a JoinLabel with two components, one of which is Top, would return true for this method.


isEnumerable

public boolean isEnumerable()
Are the components of this label enumerable?

For example, Singletons are enumerable, JoinLabels are enumerable, RuntimeLabel (the label of all runtime representable components) is not enumerable. NOTE: The components of a label are not neccessarily stuck together with a join operation. For example, the MeetLabel uses the meet operation between its components.


components

public java.util.Collection components()
Retrieve the collection of components. This method should only be called if isEnumerable returns true. This collection should not be modified.


isSingleton

public boolean isSingleton()
Does this label represent only a single label?

For example, a JoinLabel with more than one component returns false, a MeetLabel with more than one component returns false, most other Labels return true.


singletonComponent

public Label singletonComponent()
Retrieve the singleton component that this label represents. Should only be called is isSingleton returns true.


isInvariant

public boolean isInvariant()
Is this label invariant?


isCovariant

public boolean isCovariant()
Is this label covariant?


hasVariables

public boolean hasVariables()
Does this label (or any of its components) contain any label variables?


variables

public java.util.Collection variables()
The collection of variables contained by this label (or any of its components).


subst

public Label subst(LabelSubstitution substitution)
Accepts a LabelSubstitution and returns the result of substituting according to the given LabelSubstitution.

Parameters:
substitution - the LabelSubstitution to use
Returns:
the result of the substitution

labelOf

public Label labelOf()
Gets labelOf this label. Refer to Andrew's thesis, Figure 5.4


subst

public Label subst(UID uid,
                   Label L)
Substitutes any occurences of for L. Refer to Andrew's thesis, Figure 5.5


fold

public Label fold(UID uid)
Substitutes any occurences of for .


join

public Label join(Label L)
Returns the join of this label and L.


join

public Label join(Label L,
                  PrincipalHierarchy ph)
Returns the join of this label and L, and simplifies it, based on the given PrincipalHierarchy


isMeetable

public boolean isMeetable()
Can this label be used in a meet operation with another label?

For example, UnknownLabel returns false. Most other Labels return true.


meet

public Label meet(Label L)
Returns the meet of this label and L.


meet

public Label meet(Label L,
                  PrincipalHierarchy ph)
Returns the meet of this label and L, and simplifies it, based on the given PrincipalHierarchy


minus

public Label minus(Label L)
Returns a copy of this Label, with the Label L removed from the components.

Throws:
InternalCompilerError - if Label L is not a component of this label

simplify

public Label simplify()
Returns a simplified copy of this Label.


isComparable

public boolean isComparable()
Is this label comparable to other labels?

For example, an UnknownLabel is not comparable to others, neither is a VarLabel. Most other labels are.


translate

public void translate(polyglot.types.Resolver c,
                      polyglot.util.CodeWriter w)

meet_

public Label meet_(Label L,
                   PrincipalHierarchy ph)
Implementation of the meet operation, should only be called by JifTypeSystem

Parameters:
L - label to meet with.
ph - the principal hierarchy in which to perform the meet. This param may be null, in which case perform all meets possible that are indpependent of the principal hierarchy.

leq_

public boolean leq_(Label L,
                    LabelEnv env)
Implementation of leq, should only be called by JifTypeSystem

Parameters:
L - the label to determine if this label is leq to.

leq_

public boolean leq_(Label L)

componentString

public java.lang.String componentString()

description

public java.lang.String description()

description

public Label description(java.lang.String d)

toJava

public polyglot.ast.Expr toJava(JifToJavaRewriter rw)
                         throws polyglot.types.SemanticException
polyglot.types.SemanticException