jif.types.label
Class MeetLabel_c

java.lang.Object
  extended by polyglot.types.TypeObject_c
      extended by jif.types.label.Label_c
          extended by jif.types.label.MeetLabel_c
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Label, MeetLabel, Param, polyglot.types.TypeObject, polyglot.util.Copy

public class MeetLabel_c
extends Label_c
implements MeetLabel

An implementation of the MeetLabel interface.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jif.types.label.Label_c
description, toJava, variables
 
Fields inherited from class polyglot.types.TypeObject_c
position, ts
 
Constructor Summary
MeetLabel_c(java.util.Set components, JifTypeSystem ts, polyglot.util.Position pos, LabelToJavaExpr trans)
           
 
Method Summary
 java.lang.String componentString(java.util.Set printedLabels)
           
 ConfPolicy confProjection()
           
 java.lang.Object copy()
           
 boolean equalsImpl(polyglot.types.TypeObject o)
           
 int hashCode()
           
 boolean hasWritersToReaders()
          Does the label contain any writersToReaders constructs?
 IntegPolicy integProjection()
           
 boolean isBottom()
          By default, a label is not Bottom
 boolean isCanonical()
           
 boolean isComparable()
          Is this label comparable to other labels?
 boolean isCovariant()
          Is this label covariant?
protected  boolean isDisambiguatedImpl()
          Check if the label is disambiguated, without recursing into child labels.
 boolean isEnumerable()
          Are the components of this label enumerable?
 boolean isRuntimeRepresentable()
           
 boolean isTop()
          Is this label equivalent to top?
 PathMap labelCheck(JifContext A, LabelChecker lc)
          Label check the label, which will determine how much information may be gained if the label is evaluated at runtime.
 boolean leq_(Label L, LabelEnv env, LabelEnv.SearchState state)
          Implementation of leq, should only be called by JifTypeSystem
 java.util.Set meetComponents()
           
 Label normalize()
          Normalize the label.
protected  Label simplifyImpl()
           
 Label subst(LabelSubstitution substitution)
           
 java.util.List throwTypes(polyglot.types.TypeSystem ts)
          If the label is runtime representable, when it is evaluated at runtime it may throw exceptions.
 java.lang.String toString()
           
 java.lang.String toString(java.util.Set printedLabels)
           
 java.util.Set variableComponents()
          The set of variables that this label contains as components.
 
Methods inherited from class jif.types.label.Label_c
componentString, description, hasVariableComponents, hasVariables, isDisambiguated, isInvariant, setDescription, simplify, toJava, variables
 
Methods inherited from class polyglot.types.TypeObject_c
equals, position, typeSystem
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jif.types.label.Label
componentString, description, hasVariableComponents, hasVariables, isDisambiguated, isInvariant, setDescription, simplify, toJava, variables
 
Methods inherited from interface polyglot.types.TypeObject
position, typeSystem
 

Constructor Detail

MeetLabel_c

public MeetLabel_c(java.util.Set components,
                   JifTypeSystem ts,
                   polyglot.util.Position pos,
                   LabelToJavaExpr trans)
Method Detail

isRuntimeRepresentable

public boolean isRuntimeRepresentable()
Specified by:
isRuntimeRepresentable in interface Label
Specified by:
isRuntimeRepresentable in interface Param

isCanonical

public boolean isCanonical()
Specified by:
isCanonical in interface Param
Specified by:
isCanonical in interface polyglot.types.TypeObject

isDisambiguatedImpl

protected boolean isDisambiguatedImpl()
Description copied from class: Label_c
Check if the label is disambiguated, without recursing into child labels.

Specified by:
isDisambiguatedImpl in class Label_c

isCovariant

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

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

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

isEnumerable

public boolean isEnumerable()
Description copied from interface: Label
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.

Specified by:
isEnumerable in interface Label

isBottom

public boolean isBottom()
Description copied from class: Label_c
By default, a label is not Bottom

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

isTop

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

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

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

equalsImpl

public boolean equalsImpl(polyglot.types.TypeObject o)
Specified by:
equalsImpl in interface polyglot.types.TypeObject
Specified by:
equalsImpl in class Label_c

hashCode

public int hashCode()
Overrides:
hashCode in class polyglot.types.TypeObject_c

componentString

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

toString

public java.lang.String toString()
Overrides:
toString in class Label_c

toString

public java.lang.String toString(java.util.Set printedLabels)
Specified by:
toString in interface Label
Overrides:
toString in class Label_c

leq_

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

Specified by:
leq_ in interface Label
Parameters:
L - the label to determine if this label is leq to. This label always satisfies !this.equals(L)
env - the label environment (including principal hierarchy). Will always be non-null.

meetComponents

public java.util.Set meetComponents()
Specified by:
meetComponents in interface MeetLabel

copy

public java.lang.Object copy()
Specified by:
copy in interface polyglot.util.Copy
Overrides:
copy in class Label_c

normalize

public Label normalize()
Description copied from interface: Label
Normalize the label. Essentially, simplify as much as possible without using the leq ordering

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

simplifyImpl

protected Label simplifyImpl()
Overrides:
simplifyImpl in class Label_c
Returns:
An equivalent label with fewer components by pulling out less restrictive policies.

confProjection

public ConfPolicy confProjection()
Specified by:
confProjection in interface Label
Overrides:
confProjection in class Label_c

integProjection

public IntegPolicy integProjection()
Specified by:
integProjection in interface Label
Overrides:
integProjection in class Label_c

throwTypes

public java.util.List throwTypes(polyglot.types.TypeSystem ts)
Description copied from interface: Label
If the label is runtime representable, when it is evaluated at runtime it may throw exceptions. This method returns a list of the exceptions that the runtime evaluation of the label may produce. If the label cannot be evaluated at runtime, an empty list should be returned.

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

subst

public Label subst(LabelSubstitution substitution)
            throws polyglot.types.SemanticException
Specified by:
subst in interface Label
Overrides:
subst in class Label_c
Parameters:
substitution - The LabelSubstitution to apply to this label
Returns:
the result of applying labelSubst to this label.
Throws:
polyglot.types.SemanticException

hasWritersToReaders

public boolean hasWritersToReaders()
Description copied from interface: Label
Does the label contain any writersToReaders constructs?

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

variableComponents

public java.util.Set variableComponents()
Description copied from interface: Label
The set of variables that this label contains as components. This is a subset of variables(), since it does not count var labels contained in upper bounds of arg labels.

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

labelCheck

public PathMap labelCheck(JifContext A,
                          LabelChecker lc)
Description copied from interface: Label
Label check the label, which will determine how much information may be gained if the label is evaluated at runtime. For example, given the dynamic label {*lb}, where lb is a local variable, evaluation of this label at runtime will reveal as much information as the label of lb. For example, the following code is illegal, as the runtime evaluation of the label reveals too much information
 
  boolean{Alice:} secret = ...;
  final label{Alice:} lb = secret?new label{}:new label{Bob:};
  boolean{} leak = false;
  if ((*lb} <= new label{}) { // evaluation of lb reveals 
                           // information at level {Alice:} 
     leak = true;
  } 
  
 

Specified by:
labelCheck in interface Label
Overrides:
labelCheck in class Label_c
See Also:
Jif.labelCheck(LabelChecker), Principal.labelCheck(JifContext, LabelChecker)