--- /dev/null
+package Analysis.OwnershipAnalysis;
+
+import IR.*;
+import IR.Flat.*;
+import java.util.*;
+import java.io.*;
+
+
+// a change touple is a pair that indicates if the
+// first TokenTupleSet is found in a ReachabilitySet,
+// then the second TokenTupleSet should be added
+public class ChangeTuple
+{
+ private TokenTupleSet toMatch;
+ private TokenTupleSet toAdd;
+
+ public ChangeTuple( TokenTupleSet toMatch,
+ TokenTupleSet toAdd ) {
+ this.toMatch = toMatch;
+ this.toAdd = toAdd;
+ }
+
+ public TokenTupleSet getSetToMatch() { return toMatch; }
+ public TokenTupleSet getSetToAdd() { return toAdd; }
+
+ public boolean equals( Object o ) {
+ if( !(o instanceof ChangeTuple) ) {
+ return false;
+ }
+
+ ChangeTuple ct = (ChangeTuple) o;
+
+ return toMatch.equals( ct.getSetToMatch() ) &&
+ toAdd.equals( ct.getSetToAdd() );
+ }
+
+ public int hashCode() {
+ return toMatch.hashCode() + toAdd.hashCode();
+ }
+
+ public ChangeTuple copy() {
+ return new ChangeTuple( toMatch, toAdd );
+ }
+
+ public String toString() {
+ return new String( "<"+toMatch+" -> "+toAdd+">" );
+ }
+}
--- /dev/null
+package Analysis.OwnershipAnalysis;
+
+import IR.*;
+import IR.Flat.*;
+import java.util.*;
+import java.io.*;
+
+
+public class ChangeTupleSet {
+
+ public HashSet<ChangeTuple> changeTuples;
+
+ public ChangeTupleSet() {
+ changeTuples = new HashSet<ChangeTuple>();
+ }
+
+ public ChangeTupleSet( ChangeTuple ct ) {
+ this();
+ changeTuples.add( ct );
+ }
+
+ public ChangeTupleSet( ChangeTupleSet cts ) {
+ changeTuples = (HashSet<ChangeTuple>) cts.changeTuples.clone(); //COPY?!
+ }
+
+ public ChangeTupleSet union( ChangeTupleSet ctsIn ) {
+ ChangeTupleSet ctsOut = new ChangeTupleSet( this );
+ ctsOut.changeTuples.addAll( ctsIn.changeTuples );
+ return ctsOut;
+ }
+
+ public boolean isSubset( ChangeTupleSet ctsIn ) {
+ return ctsIn.changeTuples.containsAll( this.changeTuples );
+ }
+
+ public String toString() {
+ return changeTuples.toString();
+ }
+}
public HashSet<TokenTupleSet> possibleReachabilities;
-
- // this one has special union.
-}
\ No newline at end of file
+ public ReachabilitySet() {
+ possibleReachabilities = new HashSet<TokenTupleSet>();
+ }
+
+ public ReachabilitySet( ReachabilitySet rs ) {
+ possibleReachabilities = (HashSet<TokenTupleSet>) rs.possibleReachabilities.clone(); // again, DEEP COPY?!
+ }
+
+ public ReachabilitySet union( ReachabilitySet rsIn ) {
+ ReachabilitySet rsOut = new ReachabilitySet( this );
+ rsOut.possibleReachabilities.addAll( rsIn.possibleReachabilities );
+ return rsOut;
+ }
+
+ public ReachabilitySet intersection( ReachabilitySet rsIn ) {
+ ReachabilitySet rsOut = new ReachabilitySet();
+
+ Iterator i = this.possibleReachabilities.iterator();
+ while( i.hasNext() ) {
+ TokenTupleSet tts = (TokenTupleSet) i.next();
+ if( rsIn.possibleReachabilities.contains( tts ) ) {
+ rsOut.possibleReachabilities.add( tts );
+ }
+ }
+
+ return rsOut;
+ }
+
+ /*
+ public ChangeTupleSet unionUpArity( ReachabilitySet rsIn ) {
+
+ }
+ */
+}
public TokenTupleSet union( TokenTupleSet ttsIn ) {
TokenTupleSet ttsOut = new TokenTupleSet( this );
- //ttsOut.tokenTuples.addAll( ttsIn.tokenTuples );
+ ttsOut.tokenTuples.addAll( ttsIn.tokenTuples );
+ /*
Iterator i = ttsIn.tokenTuples.iterator();
while( i.hasNext() ) {
ttsOut.tokenTuples.add( (TokenTuple) i.next() );
}
+ */
return ttsOut;
}
Analysis/OwnershipAnalysis/TokenTuple.class \
Analysis/OwnershipAnalysis/TokenTupleSet.class \
Analysis/OwnershipAnalysis/ReachabilitySet.class \
+Analysis/OwnershipAnalysis/ChangeTuple.class \
+Analysis/OwnershipAnalysis/ChangeTupleSet.class \
Util/GraphNode.class Util/Namer.class Util/Relation.class \
Interface/HTTPHeader.class Interface/HTTPResponse.class \
Interface/HTTPServices.class Interface/HashStrings.class \