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

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

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

This is a degenerate result that maps all labels to a single lattice element and only knows a single label, NormalLabel. This is a useful class if you want to return the same lattice information no matter what label is used. It is the least expressive as it does not track labels, but simple.

Author:
Kevin "The German" Bierhoff

Constructor Summary
SingleResult(LE singleValue)
          Create a result that maps all labels to the given lattice element.
 
Method Summary
 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

SingleResult

public SingleResult(LE singleValue)
Create a result that maps all labels to the given lattice element.

Parameters:
singleValue - The single lattice element all labels will map to.
Method Detail

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 single value given in initially, no matter what label is requested.

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:
a keyset that contains only the normal label.

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)