|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soot.jimple.spark.ondemand.genericutil.Util
public class Util
Miscellaneous utility functions.
Field Summary | |
---|---|
static BitSet |
EMPTY_BITSET
The empty BitSet . |
static boolean |
FULLY_QUALIFIED_NAMES
Generate strings with fully qualified names or not |
Constructor Summary | |
---|---|
Util()
|
Method Summary | ||
---|---|---|
static
|
addIfNotNull(T val,
Collection<T> vals)
|
|
static boolean |
arrayContains(Object[] arr,
Object obj,
int size)
|
|
static int |
binaryLogUp(int n_)
Binary log: finds the smallest power k such that 2^k>=n |
|
static int |
binaryLogUp(long n_)
Binary log: finds the smallest power k such that 2^k>=n |
|
static void |
clear(BitSet bitSet_)
Clear a BitSet . |
|
static
|
doForAll(Collection<T> c_,
ObjectVisitor<T> v_)
Perform an action for all elements in a collection. |
|
static BigInteger |
fact(BigInteger n_)
Factorial |
|
static double |
fact(double n_)
Factorial on doubles; avoids overflow problems present when using integers. |
|
static int |
fact(int n_)
Factorial |
|
static long |
fact(long n_)
Factorial |
|
static
|
filter(Collection<T> src_,
Predicate<T> pred_)
Filter a collection: generate a new list from an existing collection, consisting of the elements satisfying some predicate. |
|
static
|
filter(Collection<T> src_,
Predicate<T> pred_,
List<T> result_)
Filter a collection according to some predicate, placing the result in a List |
|
static
|
find(Collection<T> c_,
Predicate<T> p_)
Test whether some element of the given Collection
satisfies the given Predicate . |
|
static
|
findAll(Collection<T> c_,
Predicate<T> p_)
Test whether some element of the given Collection
satisfies the given Predicate . |
|
static
|
forAll(Collection<T> c_,
Predicate<T> p_)
Test whether all elements of the given Collection
satisfy the given Predicate . |
|
static
|
forSome(Collection<T> c_,
Predicate<T> p_)
Test whether some element of the given Collection
satisfies the given Predicate . |
|
static int |
getInt(Integer i)
|
|
static int |
hashArray(Object[] objs)
|
|
static
|
intersecting(Set<T> s1,
Set<T> s2)
checks if two sets have a non-empty intersection |
|
static
|
map(List<T> srcList,
Mapper<T,U> mapper_)
Map a list: generate a new list with each element mapped. |
|
static
|
mapToSet(Collection<T> srcSet,
Mapper<T,U> mapper_)
Map a set: generate a new set with each element mapped. |
|
static String |
objArrayToString(Object[] o)
|
|
static String |
objArrayToString(Object[] o,
String start,
String end,
String sep)
|
|
static String |
objectFieldsToString(Object obj)
Write object fields to string |
|
static
|
pickNAtRandom(List<T> vals,
int n,
long seed)
|
|
static int[] |
realloc(int[] data_,
int newSize_)
|
|
static String |
removeAll(String str_,
String sub_)
Remove all occurrences of a given substring in a given String |
|
static String |
removePackageName(String fully_qualified_name_)
Remove the package name from a fully qualified class name |
|
static String |
replaceAll(String str_,
String sub_,
String newSub_)
Replace all occurrences of a given substring in a given String . |
|
static String |
str(int[] ints_)
Convert an int[] to a String for printing |
|
static String |
str(Throwable thrown_)
Get a String representation of a Throwable . |
|
static boolean |
stringContains(String str,
String subStr)
|
|
static String |
topLevelTypeString(String typeStr)
given the name of a class C, returns the name of the top-most enclosing class of class C. |
|
static String |
toStringNull(Object o)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final BitSet EMPTY_BITSET
BitSet
.
public static final boolean FULLY_QUALIFIED_NAMES
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static long fact(long n_)
public static BigInteger fact(BigInteger n_)
public static double fact(double n_)
n_
- arg on which to compute factorial
double
approximation to) factorial of largest
positive integer <= (n_ + epsilon)public static int fact(int n_)
public static int binaryLogUp(int n_)
public static int binaryLogUp(long n_)
public static String str(int[] ints_)
String
for printing
public static String objArrayToString(Object[] o)
public static String objArrayToString(Object[] o, String start, String end, String sep)
public static String str(Throwable thrown_)
String
representation of a Throwable
.
public static <T> boolean forSome(Collection<T> c_, Predicate<T> p_)
Collection
satisfies the given Predicate
.
public static <T> T find(Collection<T> c_, Predicate<T> p_)
Collection
satisfies the given Predicate
.
public static <T> Collection<T> findAll(Collection<T> c_, Predicate<T> p_)
Collection
satisfies the given Predicate
.
public static <T> boolean forAll(Collection<T> c_, Predicate<T> p_)
Collection
satisfy the given Predicate
.
public static <T> void doForAll(Collection<T> c_, ObjectVisitor<T> v_)
c_
- the collectionv_
- the visitor defining the actionpublic static <T,U> List<U> map(List<T> srcList, Mapper<T,U> mapper_)
ArrayList
; it would have been more precise to use
reflection
to create a list of the same type as
'srcList', but reflection works really slowly in some implementations, so
it's best to avoid it.
public static <T> List<T> filter(Collection<T> src_, Predicate<T> pred_)
ArrayList
; it would have been more precise to use
reflection
to create a list of the same type as
'srcList', but reflection works really slowly in some implementations, so
it's best to avoid it.
public static <T> void filter(Collection<T> src_, Predicate<T> pred_, List<T> result_)
src_
- collection to be filteredpred_
- the predicateresult_
- the list for the result. assumed to be emptypublic static <T,U> Set<U> mapToSet(Collection<T> srcSet, Mapper<T,U> mapper_)
HashSet
; it would have been more precise to use
reflection
to create a set of the same type as
'srcSet', but reflection works really slowly in some implementations, so
it's best to avoid it.
public static int[] realloc(int[] data_, int newSize_)
public static void clear(BitSet bitSet_)
BitSet
.
public static String replaceAll(String str_, String sub_, String newSub_)
String
.
public static String removeAll(String str_, String sub_)
String
public static String objectFieldsToString(Object obj)
public static String removePackageName(String fully_qualified_name_)
public static int hashArray(Object[] objs)
public static boolean arrayContains(Object[] arr, Object obj, int size)
public static String toStringNull(Object o)
public static <T> boolean intersecting(Set<T> s1, Set<T> s2)
s1
- s2
-
true
if the sets intersect; false
otherwisepublic static boolean stringContains(String str, String subStr)
public static int getInt(Integer i)
public static String topLevelTypeString(String typeStr)
typeStr
-
public static <T> void addIfNotNull(T val, Collection<T> vals)
public static <T> List<T> pickNAtRandom(List<T> vals, int n, long seed)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |