All Packages Class Hierarchy This Package Previous Next Index
Class harpoon.Util.Util
java.lang.Object
|
+----harpoon.Util.Util
- public abstract class Util
- extends Object
Miscellaneous static utility functions.
- Version:
- $Id: Util.java,v 1.12 1998/11/10 03:34:37 cananian Exp $
- Author:
- C. Scott Ananian <cananian@alumni.princeton.edu>
-
Util()
-
-
assert(boolean)
- Hacked assertion facility
-
assert(boolean, String)
-
-
copy(Object[])
- Copy an array type to prevent modification.
-
escape(String)
- Escape the contents of a String so they are safe to print.
-
ffs(int)
- Find first set (least significant bit).
-
ffs(long)
- Find first set (least significant bit).
-
fls(int)
- Find last set (most significant bit).
-
fls(long)
- Find last set (most significant bit).
-
grow(Object[], Object, int)
- Insert element
o
before src[n]
.
-
log2c(int)
- Returns ceil(log2(n))
-
repeatString(String, int)
- Repeat a given string a certain number of times.
-
shrink(Object[], int)
- Remove element 'n' from array 'src'.
Util
public Util()
copy
public static final Object[] copy(Object src[])
- Copy an array type to prevent modification. Does not bother
to copy array types of length 0, because they're already immutable.
shrink
public static final Object[] shrink(Object src[],
int n)
- Remove element 'n' from array 'src'.
grow
public static final Object[] grow(Object src[],
Object o,
int n)
- Insert element
o
before src[n]
.
After return, src[n]==o
.
escape
public static final String escape(String str)
- Escape the contents of a String so they are safe to print.
assert
public static final void assert(boolean val)
- Hacked assertion facility
assert
public static final void assert(boolean val,
String msg)
repeatString
public static final String repeatString(String s,
int n)
- Repeat a given string a certain number of times.
- Returns:
- a string consisting of
s
repeated n
times.
ffs
public static final int ffs(int v)
- Find first set (least significant bit).
- Returns:
- the first bit set in the argument.
ffs(0)==0
and ffs(1)==1
.
ffs
public static final int ffs(long v)
- Find first set (least significant bit).
- Returns:
- the first bit set in the argument.
ffs(0)==0
and ffs(1)==1
.
fls
public static final int fls(int v)
- Find last set (most significant bit).
- Returns:
- the last bit set in the argument.
fls(0)==0
and fls(1)==1
.
fls
public static final int fls(long v)
- Find last set (most significant bit).
- Returns:
- the last bit set in the argument.
fls(0)==0
and fls(1)==1
.
log2c
public static final int log2c(int v)
- Returns ceil(log2(n))
All Packages Class Hierarchy This Package Previous Next Index