dk.brics.string.intermediate.operations
Class AliasTable

java.lang.Object
  extended by dk.brics.string.intermediate.operations.AliasTable

public class AliasTable
extends Object

Represents the aliasing status between a set of variables.

This class is responsible for an efficient representation. To this end, the following semantic assumptions are exploited:

Those assumptions affect the behaviour of the setAliasStatus(dk.brics.string.intermediate.Variable, dk.brics.string.intermediate.Variable, dk.brics.string.intermediate.operations.AliasStatus) methods in these ways:


Constructor Summary
AliasTable(Set<Variable> variables, AliasStatus initial)
          Creates variable aliasings between the specified variables.
 
Method Summary
 AliasStatus getAliasStatus(UnorderedPair<Variable> pair)
          Returns the current aliasing status between two variables.
 AliasStatus getAliasStatus(Variable a, Variable b)
          Returns the current aliasing status between two variables.
 boolean setAliasStatus(UnorderedPair<Variable> pair, AliasStatus status)
          Sets the current aliasing status between two variables.
 boolean setAliasStatus(Variable a, Variable b, AliasStatus status)
          Sets the current aliasing status between two variables.
 String toString()
          Returns the result of toString on the underlying map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AliasTable

public AliasTable(Set<Variable> variables,
                  AliasStatus initial)
Creates variable aliasings between the specified variables. Only variables in the specified set may be used in queries to this object.

Parameters:
variables - the variables to track aliasing between.
initial - the initial aliasing status between all pairs of variables
Method Detail

getAliasStatus

public AliasStatus getAliasStatus(UnorderedPair<Variable> pair)
Returns the current aliasing status between two variables.

Parameters:
pair - a pair of variables from the set passed to AliasTable's constructor.
Returns:
an aliasing status. null is never returned.

getAliasStatus

public AliasStatus getAliasStatus(Variable a,
                                  Variable b)
Returns the current aliasing status between two variables.

Parameters:
a - a variable from the set passed to AliasTable's constructor.
b - a variable from the set passed to AliasTable's constructor.
Returns:
an aliasing status. null is never returned.

setAliasStatus

public boolean setAliasStatus(UnorderedPair<Variable> pair,
                              AliasStatus status)
Sets the current aliasing status between two variables. If the two variables are the same, only DEFINITELY is accepted.

Parameters:
pair - a pair of variables from the set passed to AliasTable's constructor.
Returns:
true if something changed

setAliasStatus

public boolean setAliasStatus(Variable a,
                              Variable b,
                              AliasStatus status)
Sets the current aliasing status between two variables. The order of the arguments is irrelevant.

The semantic assumption listed in AliasTable may override the change.

Returns:
true if something changed

toString

public String toString()
Returns the result of toString on the underlying map. Mostly useful when running the integrated debugger.

Overrides:
toString in class Object


Copyright © 2003-2009 Anders Møller, Aske Simon Christensen, Asger Feldthaus.