edu.cmu.cs.crystal.flow
Class LabeledSingleResult<LE>

java.lang.Object
  extended by edu.cmu.cs.crystal.flow.LabeledSingleResult<LE>
Type Parameters:
LE - the type that represents the lattice element
All Implemented Interfaces:
IResult<LE>

public class LabeledSingleResult<LE>
extends Object
implements IResult<LE>

This class maps a set of known labels to a single lattice element. This is different from @link{SingleResult} because it will return a keyset which may contain more labels, so it will preserve the independence of those branches.

Author:
Kevin Bierhoff

Constructor Summary
LabeledSingleResult(LE singleValue, Collection<ILabel> labels)
          Creates a result that maps the given labels to the given lattice element.
 
Method Summary
static
<LE> IResult<LE>
createResult(LE value, Collection<ILabel> labels)
          Creates a result that maps the given labels to the given lattice element.
static
<LE> IResult<LE>
createResult(LE value, ILabel... labels)
          Creates a result that maps the given labels to the given lattice element.
 LE get(ILabel label)
          Clients should not modify the returned value.
 IResult<LE> join(IResult<LE> otherResult, IAbstractLatticeOperations<LE,?> op)
          Clients do not usually call this method.
 Set<ILabel> keySet()
          Returns the set of labels mapped by this IResult.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LabeledSingleResult

public LabeledSingleResult(LE singleValue,
                           Collection<ILabel> labels)
Creates a result that maps the given labels to the given lattice element.

Parameters:
singleValue - The lattice element all given labels will map to.
labels - The labels known to this result.
Method Detail

createResult

public static <LE> IResult<LE> createResult(LE value,
                                            Collection<ILabel> labels)
Creates a result that maps the given labels to the given lattice element.

Parameters:
value - The lattice element all given labels will map to.
labels - The labels known to this result.

createResult

public static <LE> IResult<LE> createResult(LE value,
                                            ILabel... labels)
Creates a result that maps the given labels to the given lattice element.

Parameters:
value - The lattice element all given labels will map to.
labels - The labels known to this result.

keySet

public Set<ILabel> keySet()
Description copied from interface: IResult
Returns the set of labels mapped by this IResult.

Specified by:
keySet in interface IResult<LE>
Returns:
The set of labels mapped by this IResult. This method must not return null

get

public LE get(ILabel label)
Description copied from interface: IResult
Clients should not modify the returned value. Implementers must provide a default value if label is null.

Specified by:
get in interface IResult<LE>
Returns:
the default value, regardless of the label requested.

join

public IResult<LE> join(IResult<LE> otherResult,
                        IAbstractLatticeOperations<LE,?> op)
Description copied from interface: IResult
Clients do not usually call this method. Implementations join two results "pointwise" by joining lattice elements with the same label. This method must not modify either IResult objects passed in.

Specified by:
join in interface IResult<LE>
Parameters:
otherResult - IResult object to join this IResult with.
op - Lattice operations so we can join individual elements.
Returns:
Pointwise joined lattice elements.
See Also:
ILatticeOperations.join(LE, LE, org.eclipse.jdt.core.dom.ASTNode)