KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > soot > toolkits > scalar > FlowSet


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 1997-1999 Raja Vallee-Rai
3  * modified 2002 Florian Loitsch
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */

20
21 /*
22  * Modified by the Sable Research Group and others 1997-1999.
23  * See the 'credits' file distributed with Soot for the complete list of
24  * contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
25  */

26
27
28 package soot.toolkits.scalar;
29
30 import soot.*;
31 import soot.util.*;
32 import java.util.*;
33
34 /**
35  * Represents information for flow analysis.
36  * A FlowSet is an element of a lattice; this lattice might be described by a
37  * FlowUniverse.
38  * If add, remove, size, isEmpty, toList and contains are implemented, the
39  * lattice must be the powerset of some set.
40  *
41  * @see: FlowUniverse
42  */

43 public interface FlowSet {
44   /**
45    * Clones the current FlowSet.
46    */

47   public Object JavaDoc clone();
48
49   /**
50    * returns an empty set, most often more efficient than:
51    * <code>((FlowSet)clone()).clear()</code>
52    */

53   public Object JavaDoc emptySet();
54
55   /**
56    * Copies the current FlowSet into dest.
57    */

58   public void copy(FlowSet dest);
59
60   /**
61    * Sets this FlowSet to the empty set (more generally, the bottom element
62    * of the lattice.) */

63   public void clear();
64
65   /**
66    * Returns the union (join) of this FlowSet and <code>other</code>, putting
67    * result into <code>this</code>. */

68   public void union(FlowSet other);
69
70   /**
71    * Returns the union (join) of this FlowSet and <code>other</code>, putting
72    * result into <code>dest</code>. <code>dest</code>, <code>other</code> and
73    * <code>this</code> could be the same object.
74    */

75   public void union(FlowSet other, FlowSet dest);
76
77   /**
78    * Returns the intersection (meet) of this FlowSet and <code>other</code>,
79    * putting result into <code>this</code>.
80    */

81   public void intersection(FlowSet other);
82
83   /**
84    * Returns the intersection (meet) of this FlowSet and <code>other</code>,
85    * putting result into <code>dest</code>. <code>dest</code>,
86    * <code>other</code> and <code>this</code> could be the same object.
87    */

88   public void intersection(FlowSet other, FlowSet dest);
89
90   /**
91    * Returns the set difference (this intersect ~other) of this FlowSet and
92    * <code>other</code>, putting result into <code>this</code>.
93    */

94   public void difference(FlowSet other);
95
96   /**
97    * Returns the set difference (this intersect ~other) of this FlowSet and
98    * <code>other</code>, putting result into <code>dest</code>.
99    * <code>dest</code>, <code>other</code> and <code>this</code> could be the
100    * same object.
101    */

102   public void difference(FlowSet other, FlowSet dest);
103
104   /**
105    * Returns true if this FlowSet is the empty set.
106    */

107   public boolean isEmpty();
108
109   /* The following methods force the FlowSet to be a powerset. */
110
111   /**
112    * Returns the size of the current FlowSet.
113    */

114   public int size();
115
116   /**
117    * Adds <code>obj</code> to <code>this</code>.
118    */

119   public void add(Object JavaDoc obj);
120
121   /**
122    * puts <code>this</code> union <code>obj</code> into <code>dest</code>.
123    */

124   public void add(Object JavaDoc obj, FlowSet dest);
125
126   /**
127    * Removes <code>obj</code> from <code>this</code>.
128    */

129   public void remove(Object JavaDoc obj);
130
131   /**
132    * Puts <code>this</code> minus <code>obj</code> into <code>dest</code>.
133    */

134   public void remove(Object JavaDoc obj, FlowSet dest);
135
136   /**
137    * Returns true if this FlowSet contains <code>obj</code>.
138    */

139   public boolean contains(Object JavaDoc obj);
140
141   /**
142    * returns an iterator over the elements of the flowSet. Note that the
143    * iterator might be backed, and hence be faster in the creation, than doing
144    * <code>toList().iterator()</code>.
145    */

146   public Iterator iterator();
147
148   /**
149    * Returns an unbacked list of contained objects for this FlowSet.
150    */

151   public List toList();
152 }
153
154
Popular Tags