Modifier and Type | Field and Description |
---|---|
static int |
PRINTING_LINE_WIDTH |
static char |
SECTION_CHARACTER |
static char |
SEPERATOR_CHARACTER |
static char |
SUB_SECTION_CHARACTER |
Constructor and Description |
---|
Util() |
Modifier and Type | Method and Description |
---|---|
static <T> void |
atPutGrow(List<T> list,
int pos,
T x,
T filler)
Sets the element at a given position of a list and ensures that this position exists.
|
static void |
breakpoint() |
static Integer[] |
createSortedPermutation(int size,
Comparator<Integer> comparator)
Creates an array of integers of length "size", in which each number from 0 to (size - 1)
occurs exactly once.
|
static void |
guarantee(boolean b,
String string) |
static int |
hash1(int hash,
Object x)
Utility method to combine a base hash with the identity hash of one or more objects.
|
static int |
hash2(int hash,
Object x,
Object y)
Utility method to combine a base hash with the identity hash of one or more objects.
|
static int |
hash3(int hash,
Object x,
Object y,
Object z)
Utility method to combine a base hash with the identity hash of one or more objects.
|
static int |
hash4(int hash,
Object x,
Object y,
Object z,
Object w)
Utility method to combine a base hash with the identity hash of one or more objects.
|
static boolean |
is32bit(long x) |
static boolean |
isByte(int x)
Determines if a given
int value is the range of signed byte values. |
static boolean |
isByte(long l)
Determines if a given
long value is the range of signed byte values. |
static boolean |
isInt(long l)
Determines if a given
long value is the range of signed int values. |
static boolean |
isShiftCount(int x) |
static boolean |
isShort(int x)
Determines if a given
int value is the range of signed short values. |
static boolean |
isUByte(int x)
Determines if a given
int value is the range of unsigned byte values. |
static boolean |
isUByte(long x)
Determines if a given
long value is the range of unsigned byte values. |
static boolean |
isUInt(long x)
Determines if a given
long value is the range of unsigned int values. |
static void |
printBytes(long address,
byte[] array,
int bytesPerLine)
Prints entries in a byte array as space separated hex values to
TTY . |
static void |
printBytes(long address,
byte[] array,
int offset,
int length,
int bytesPerLine)
Prints entries in a byte array as space separated hex values to
TTY . |
static void |
printSection(String name,
char sectionCharacter) |
static <T> boolean |
replaceInList(T a,
T b,
List<T> list) |
static int |
roundUp(int number,
int mod) |
static int |
safeToInt(long l) |
static short |
safeToShort(int v) |
static <T> T |
uncheckedCast(Class<T> type,
Object object)
Statically cast an object to an arbitrary Object type.
|
static <T> T |
uncheckedCast(Object object)
Statically cast an object to an arbitrary Object type.
|
static void |
warning(String string) |
public static final int PRINTING_LINE_WIDTH
public static final char SECTION_CHARACTER
public static final char SUB_SECTION_CHARACTER
public static final char SEPERATOR_CHARACTER
public Util()
public static <T> boolean replaceInList(T a, T b, List<T> list)
public static <T> T uncheckedCast(Class<T> type, Object object)
public static <T> T uncheckedCast(Object object)
public static int hash1(int hash, Object x)
hash
- the base hashx
- the object to add to the hashpublic static int hash2(int hash, Object x, Object y)
hash
- the base hashx
- the first object to add to the hashy
- the second object to add to the hashpublic static int hash3(int hash, Object x, Object y, Object z)
hash
- the base hashx
- the first object to add to the hashy
- the second object to add to the hashz
- the third object to add to the hashpublic static int hash4(int hash, Object x, Object y, Object z, Object w)
hash
- the base hashx
- the first object to add to the hashy
- the second object to add to the hashz
- the third object to add to the hashw
- the fourth object to add to the hashpublic static <T> void atPutGrow(List<T> list, int pos, T x, T filler)
list
- the list to put the element intopos
- the position at which to insert the elementx
- the element that should be insertedfiller
- the filler element that is used for the intermediate positions in case the list
is shorter than pospublic static void breakpoint()
public static int safeToInt(long l)
public static int roundUp(int number, int mod)
public static void printSection(String name, char sectionCharacter)
public static void printBytes(long address, byte[] array, int bytesPerLine)
TTY
.address
- an address at which the bytes are located. This is used to print an address
prefix per line of output.array
- the array containing all the bytes to printbytesPerLine
- the number of values to print per line of outputpublic static void printBytes(long address, byte[] array, int offset, int length, int bytesPerLine)
TTY
.address
- an address at which the bytes are located. This is used to print an address
prefix per line of output.array
- the array containing the bytes to printoffset
- the offset in array
of the values to printlength
- the number of values from array
printbytesPerLine
- the number of values to print per line of outputpublic static boolean isShiftCount(int x)
public static boolean isUByte(int x)
int
value is the range of unsigned byte values.public static boolean isByte(int x)
int
value is the range of signed byte values.public static boolean isUByte(long x)
long
value is the range of unsigned byte values.public static boolean isByte(long l)
long
value is the range of signed byte values.public static boolean isUInt(long x)
long
value is the range of unsigned int values.public static boolean isInt(long l)
long
value is the range of signed int values.public static boolean isShort(int x)
int
value is the range of signed short values.public static boolean is32bit(long x)
public static short safeToShort(int v)
public static Integer[] createSortedPermutation(int size, Comparator<Integer> comparator)
size
- The size of the range to be sorted.comparator
- A comparator that is used to compare indexes.