Class CommonHelper
java.lang.Object
com.pixelmonmod.pixelmon.api.util.helpers.CommonHelper
Miscellaneous utility methods.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> Map<K, V> addEntries
(Map<K, V> map, Object[] kvs) adds entries for every 2 objects inkvs
.static <K,
V> Map<K, V> addEntries
(Map<K, V> map, K[] keys, V[] vals) static byte[]
decodeInteger
(int encoded, int size) Decodes an integer into an array of small numbersstatic boolean
disableLogMessage
(Class<?> clazz, String regex) static int
encodeInteger
(byte[] toEncode, int size) Encodes an array of small numbers into an integer.static void
ensureIndex
(List<?> a, int i) static <V> V
getIgnoreCase
(Map<String, V> map, String key) static int
indexOfAbsoluteMax
(Object array) static <T> void
Sets the index of the first null element ina
tovalue
, or addsvalue
to the end ofa
if none of the elements are null.static <T> T
static String
textInQuotes
(String str) static Object[]
wrapperArray
(Object aprimitive)
-
Field Details
-
bitFilters
public static final int[] bitFilters
-
-
Constructor Details
-
CommonHelper
public CommonHelper()
-
-
Method Details
-
ensureIndex
- Parameters:
a
-i
-
-
set
-
insert
Sets the index of the first null element ina
tovalue
, or addsvalue
to the end ofa
if none of the elements are null.- Parameters:
a
-value
-
-
indexOfAbsoluteMax
- Parameters:
array
- - An Array of either Number primitives, or actual Number objects- Returns:
- The index of the max value, or -1 if there was more than one instance of the max value in the array
- Throws:
ClassCastException
- if you fail at reading javadocs
-
wrapperArray
-
addEntries
-
addEntries
adds entries for every 2 objects inkvs
. -
getIgnoreCase
-
textInQuotes
-
decodeInteger
public static byte[] decodeInteger(int encoded, int size) Decodes an integer into an array of small numbers- Parameters:
encoded
- The integer created from the #encodeInteger methodsize
- The bitwidth per smaller number. The maximum size for the smaller inclusions is equal to 2^size. Note: this method only supports sizes from 1-8 inclusive.- Returns:
- The decoded array
-
encodeInteger
public static int encodeInteger(byte[] toEncode, int size) Encodes an array of small numbers into an integer.- Parameters:
toEncode
- The array to encodesize
- The bitwidth of each small number. The maximum value for each smaller value is equal top 2^size. Numbers larger than this will have additional bits discarded.- Returns:
-
disableLogMessage
-