/* VariableSet (c) 1998 Jochen Hoenicke * * You may distribute under the terms of the GNU General Public License. * * IN NO EVENT SHALL JOCHEN HOENICKE BE LIABLE TO ANY PARTY FOR DIRECT, * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF JOCHEN HOENICKE * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * JOCHEN HOENICKE SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND JOCHEN HOENICKE HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * $Id$ */ package jode.flow; import jode.LocalInfo; /** * 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.
*/
public class VariableSet extends java.util.Vector {
/**
* Creates a new empty variable set
*/
public VariableSet() {
}
/**
* Adds a local variable to the variable set.
* @param li The local variable of type LocalInfo.
*/
public void addElement(LocalInfo li) {
super.addElement((Object)li);
}
/**
* Merges the current VariableSet with another. For all slots occuring
* in both variable sets, all corresponding LocalInfos are merged.
* The variable sets are not changed (use union for this).
* @return The merged variables.
* @param vs the other variable set.
*/
public VariableSet merge(VariableSet vs) {
VariableSet merged = new VariableSet();
for (int i=0; i