jif.types
Class JoinLabel_c

java.lang.Object
  extended bypolyglot.ext.jl.types.TypeObject_c
      extended byjif.types.Label_c
          extended byjif.types.JoinLabel_c
All Implemented Interfaces:
java.lang.Cloneable, polyglot.util.Copy, JoinLabel, Label, Param, java.io.Serializable, polyglot.types.TypeObject

public class JoinLabel_c
extends Label_c
implements JoinLabel

An implementation of the JoinLabel interface.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class polyglot.ext.jl.types.TypeObject_c
position, ts
 
Constructor Summary
protected JoinLabel_c()
           
  JoinLabel_c(JifTypeSystem ts, polyglot.util.Position pos, java.util.Collection components)
           
 
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.
 JoinLabel components(java.util.Collection c)
           
 java.lang.String componentString()
           
 Label flatten()
           
 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 isCanonical()
          By default labels are canonical.
 boolean isComparable()
          Is this label comparable to other labels?
 boolean isCovariant()
          Is this label covariant?
 boolean isMeetable()
          Can this label be used in a meet operation with another label?
 boolean isRuntimeRepresentable()
           
 Label labelOf()
          Gets labelOf this label.
 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 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 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.
 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 class jif.types.Label_c
description, description, isEnumerable, isInvariant, isSingleton, isTop, join, join, meet, singletonComponent, toJava, toString
 
Methods inherited from class polyglot.ext.jl.types.TypeObject_c
copy, equals, equalsImpl, position, typeSystem
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jif.types.Label
description, description, isEnumerable, isInvariant, isSingleton, isTop, join, join, meet, singletonComponent, toJava
 
Methods inherited from interface polyglot.types.TypeObject
equalsImpl, position, typeSystem
 
Methods inherited from interface polyglot.util.Copy
copy
 

Constructor Detail

JoinLabel_c

protected JoinLabel_c()

JoinLabel_c

public JoinLabel_c(JifTypeSystem ts,
                   polyglot.util.Position pos,
                   java.util.Collection components)
Method Detail

flatten

public Label flatten()
Specified by:
flatten in interface JoinLabel

minus

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

Specified by:
minus in interface Label
Overrides:
minus in class Label_c

isBottom

public boolean isBottom()
Description copied from interface: Label
Is this label equivalent to bottom?

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

Specified by:
isBottom in interface Label
Overrides:
isBottom in class Label_c

isComparable

public boolean isComparable()
Description copied from interface: Label
Is this label comparable to other labels?

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

Specified by:
isComparable in interface Label

isMeetable

public boolean isMeetable()
Description copied from interface: Label
Can this label be used in a meet operation with another label?

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

Specified by:
isMeetable in interface Label
Overrides:
isMeetable in class Label_c

isCanonical

public boolean isCanonical()
Description copied from class: Label_c
By default labels are canonical.

Specified by:
isCanonical in interface Param
Overrides:
isCanonical in class Label_c

isCovariant

public boolean isCovariant()
Description copied from interface: Label
Is this label covariant?

Specified by:
isCovariant in interface Label
Specified by:
isCovariant in class Label_c
Returns:
true iff this label is covariant. A label is covariant if it contains at least one covariant component.

hasVariables

public boolean hasVariables()
Description copied from interface: Label
Does this label (or any of its components) contain any label variables?

Specified by:
hasVariables in interface Label
Overrides:
hasVariables in class Label_c

variables

public java.util.Collection variables()
Description copied from interface: Label
The collection of variables contained by this label (or any of its components).

Specified by:
variables in interface Label
Specified by:
variables in class Label_c

isRuntimeRepresentable

public boolean isRuntimeRepresentable()
Specified by:
isRuntimeRepresentable in interface Param
Specified by:
isRuntimeRepresentable in class Label_c

labelOf

public Label labelOf()
Description copied from interface: Label
Gets labelOf this label. Refer to Andrew's thesis, Figure 5.4

Specified by:
labelOf in interface Label
Specified by:
labelOf in class Label_c

subst

public Label subst(LabelSubstitution substitution)
            throws polyglot.types.SemanticException
Description copied from interface: Label
Accepts a LabelSubstitution and returns the result of substituting according to the given LabelSubstitution.

Specified by:
subst in interface Label
Overrides:
subst in class Label_c
Throws:
polyglot.types.SemanticException

subst

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

Specified by:
subst in interface Label
Overrides:
subst in class Label_c

fold

public Label fold(UID uid)
Description copied from interface: Label
Substitutes any occurences of for .

Specified by:
fold in interface Label
Overrides:
fold in class Label_c

components

public JoinLabel components(java.util.Collection c)

components

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

Specified by:
components in interface Label
Overrides:
components in class Label_c

bound

public Label bound(VarMap ub,
                   java.util.Set visited)
Description copied from interface: Label
Gets the upper bound of this label.

Specified by:
bound in interface Label
Overrides:
bound in class Label_c

leq_

public boolean leq_(Label L,
                    LabelEnv env)
Description copied from interface: Label
Implementation of leq, should only be called by JifTypeSystem

Specified by:
leq_ in interface Label
Specified by:
leq_ in class Label_c
Returns:
true iff ph |- this <= L. Assumes there are no variables in the label.

simplify

public Label simplify()
Description copied from interface: Label
Returns a simplified copy of this Label.

Specified by:
simplify in interface Label
Overrides:
simplify in class Label_c
Returns:
An equivalent label with fewer components by pulling out less restrictive policies.

meet_

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

Specified by:
meet_ in interface Label
Specified by:
meet_ in class Label_c

componentString

public java.lang.String componentString()
Specified by:
componentString in interface Label
Specified by:
componentString in class Label_c

translate

public void translate(polyglot.types.Resolver c,
                      polyglot.util.CodeWriter w)
Specified by:
translate in interface Label
Specified by:
translate in class Label_c