Jode 1.90-CVS
Build Aug 6, 2004

net.sf.jode.flow
Class VariableSet

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractSet
          extended bynet.sf.jode.flow.VariableSet
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.Set

public final class VariableSet
extends java.util.AbstractSet
implements java.lang.Cloneable

This class represents a set of Variables, which are mainly used in the in/out sets of StructuredBlock. The type of the Variables is LocalInfo.

It defines some Helper-Function, like intersecting, merging, union and difference.

Note that a variable set can contain LocalInfos that use the same slot, but are different.


Constructor Summary
VariableSet()
          Creates a new empty variable set
VariableSet(LocalInfo[] locals)
          Creates a new pre initialized variable set
 
Method Summary
 boolean add(java.lang.Object li)
          Adds a local info to this variable set.
 void clear()
          Removes everything from this variable set.
 java.lang.Object clone()
           
 boolean contains(java.lang.Object li)
          Checks if the variable set contains the given local info.
 boolean containsSlot(int slot)
          Checks if the variable set contains a local with the given name.
 LocalInfo findLocal(java.lang.String name)
          Checks if the variable set contains a local with the given name.
 LocalInfo findSlot(int slot)
          Checks if the variable set contains a local with the given slot.
 void grow(int size)
           
 VariableSet intersect(VariableSet vs)
          Intersects the current VariableSet with another and returns the intersection.
 java.util.Iterator iterator()
           
 void mergeGenKill(java.util.Collection gen, SlotSet kill)
          Add the variables in gen to the current set, unless there are variables in kill using the same slot.
 void mergeRead(LocalInfo li)
          Merges the localinfo with this gen set and remove all variables that are killed by it.
 void mergeWrite(LocalInfo li)
          Add li to this gen set and remove all variables that are killed by it.
 boolean remove(java.lang.Object li)
          Removes a local info from this variable set.
 int size()
           
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, isEmpty, retainAll, toArray, toArray
 

Constructor Detail

VariableSet

public VariableSet()
Creates a new empty variable set


VariableSet

public VariableSet(LocalInfo[] locals)
Creates a new pre initialized variable set

Method Detail

grow

public final void grow(int size)

add

public boolean add(java.lang.Object li)
Adds a local info to this variable set.

Specified by:
add in interface java.util.Set

contains

public boolean contains(java.lang.Object li)
Checks if the variable set contains the given local info.

Specified by:
contains in interface java.util.Set

containsSlot

public final boolean containsSlot(int slot)
Checks if the variable set contains a local with the given name.


findLocal

public LocalInfo findLocal(java.lang.String name)
Checks if the variable set contains a local with the given name.


findSlot

public LocalInfo findSlot(int slot)
Checks if the variable set contains a local with the given slot.


remove

public boolean remove(java.lang.Object li)
Removes a local info from this variable set.

Specified by:
remove in interface java.util.Set

size

public int size()
Specified by:
size in interface java.util.Set

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.util.Set

clear

public void clear()
Removes everything from this variable set.

Specified by:
clear in interface java.util.Set

clone

public java.lang.Object clone()

intersect

public VariableSet intersect(VariableSet vs)
Intersects the current VariableSet with another and returns the intersection. The existing VariableSet are not changed.

Parameters:
vs - the other variable set.

mergeGenKill

public void mergeGenKill(java.util.Collection gen,
                         SlotSet kill)
Add the variables in gen to the current set, unless there are variables in kill using the same slot.

Parameters:
gen - The gen set.
kill - The kill set.

mergeRead

public void mergeRead(LocalInfo li)
Merges the localinfo with this gen set and remove all variables that are killed by it. This differs by mergeWrite in that it merges li.

Parameters:
li - the variable to add.

mergeWrite

public void mergeWrite(LocalInfo li)
Add li to this gen set and remove all variables that are killed by it.

Parameters:
li - the variable to add.

Jode 1.90-CVS
Build Aug 6, 2004

Copyright © 1998-2004 by Jochen Hoenicke.