Package com.ibm.wala.util.intset
Class IntSetUtil
- java.lang.Object
-
- com.ibm.wala.util.intset.IntSetUtil
-
public class IntSetUtil extends java.lang.ObjectUtilities for dealing withIntSets
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringINT_SET_FACTORY_CONFIG_PROPERTY_NAME
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IntSetadd(IntSet s, int j)static intbinarySearch(int[] data, int key, int low, int high)static IntSetdiff(IntSet A, IntSet B)Compute the asymmetric difference of two sets, a \ b.static IntSetdiff(IntSet A, IntSet B, MutableIntSetFactory<?> factory)Compute the asymmetric difference of two sets, a \ b.static MutableIntSetFactory<?>getDefaultIntSetFactory()static MutableIntSetmake()static MutableIntSetmake(int[] initial)static IntSetmake(java.util.Set<java.lang.Integer> x)static MutableIntSetmakeMutableCopy(IntSet set)This method constructs an appropriate mutable copy of set.static MutableIntSetremoveAll(MutableIntSet A, IntSet B)Subtract two sets, i.e.static voidsetDefaultIntSetFactory(MutableIntSetFactory<?> defaultIntSetFactory)static int[]toArray(IntSet s)
-
-
-
Field Detail
-
INT_SET_FACTORY_CONFIG_PROPERTY_NAME
public static final java.lang.String INT_SET_FACTORY_CONFIG_PROPERTY_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
make
public static MutableIntSet make()
-
make
public static MutableIntSet make(int[] initial)
-
make
public static IntSet make(java.util.Set<java.lang.Integer> x)
-
makeMutableCopy
public static MutableIntSet makeMutableCopy(IntSet set) throws java.lang.IllegalArgumentException, UnimplementedError
This method constructs an appropriate mutable copy of set.- Returns:
- a new
MutableIntSetobject with the same value as set - Throws:
UnimplementedError- if we haven't supported the set type yet.java.lang.IllegalArgumentException- if set == null
-
diff
public static IntSet diff(IntSet A, IntSet B)
Compute the asymmetric difference of two sets, a \ b.
-
diff
public static IntSet diff(IntSet A, IntSet B, MutableIntSetFactory<?> factory)
Compute the asymmetric difference of two sets, a \ b.
-
removeAll
public static MutableIntSet removeAll(MutableIntSet A, IntSet B) throws java.lang.IllegalArgumentException
Subtract two sets, i.e. a = a \ b.- Throws:
java.lang.IllegalArgumentException- if B == null
-
binarySearch
public static int binarySearch(int[] data, int key, int low, int high) throws java.lang.IllegalArgumentException- Returns:
- index \in [low,high] s.t. data[index] = key, or -1 if not found
- Throws:
java.lang.IllegalArgumentException
-
getDefaultIntSetFactory
public static MutableIntSetFactory<?> getDefaultIntSetFactory()
- Returns:
- Returns the defaultIntSetFactory.
-
setDefaultIntSetFactory
public static void setDefaultIntSetFactory(MutableIntSetFactory<?> defaultIntSetFactory)
- Parameters:
defaultIntSetFactory- The defaultIntSetFactory to set.
-
add
public static IntSet add(IntSet s, int j) throws java.lang.IllegalArgumentException
- Returns:
- a new sparse int set which adds j to s
- Throws:
java.lang.IllegalArgumentException- if s == null
-
toArray
public static int[] toArray(IntSet s)
-
-