Class InvocationUtils
java.lang.Object
io.github.lukebemish.brainfrick.lang.runtime.InvocationUtils
Contains methods used while invoking
Caller
instances from a compiled brainmap, or when attempting to box or
unbox values in order to create integer indices during Cells.asInt(int)
.-
Method Summary
Modifier and TypeMethodDescriptionstatic byte
Attempts to unbox or convert a value to a byte.static char
Attempts to unbox or convert a value to a char.static double
Attempts to unbox or convert a value to a double.static float
Attempts to unbox or convert a value to a float.static int
Attempts to unbox or convert a value to an int.static long
Attempts to unbox or convert a value to a long.static short
Attempts to unbox or convert a value to a short.static boolean
Attempts to unbox or convert a value to a boolean.static void
checkEnough
(int size, int needed) Checks whether the given buffer size is larger than the required buffer size.
-
Method Details
-
checkEnough
public static void checkEnough(int size, int needed) Checks whether the given buffer size is larger than the required buffer size.- Parameters:
size
- The number of values the buffer can provide.needed
- The number of values needed to invoke the method.- Throws:
BufferTooSmallException
- if the provided buffer size is less than the required size.
-
asI
Attempts to unbox or convert a value to an int.- Parameters:
obj
- An object to unbox.- Returns:
- An integer representation of the object.
- Throws:
ImproperTypeException
- if the value cannot be unboxed or converted.- See Also:
-
asS
Attempts to unbox or convert a value to a short.- Parameters:
obj
- An object to unbox.- Returns:
- A short representation of the object.
- Throws:
ImproperTypeException
- if the value cannot be unboxed or converted.- See Also:
-
asB
Attempts to unbox or convert a value to a byte.- Parameters:
obj
- An object to unbox.- Returns:
- A byte representation of the object.
- Throws:
ImproperTypeException
- if the value cannot be unboxed or converted.- See Also:
-
asC
Attempts to unbox or convert a value to a char.- Parameters:
obj
- An object to unbox.- Returns:
- A char representation of the object.
- Throws:
ImproperTypeException
- if the value cannot be unboxed or converted.- See Also:
-
asJ
Attempts to unbox or convert a value to a long.- Parameters:
obj
- An object to unbox.- Returns:
- A long representation of the object.
- Throws:
ImproperTypeException
- if the value cannot be unboxed or converted.- See Also:
-
asF
Attempts to unbox or convert a value to a float.- Parameters:
obj
- An object to unbox.- Returns:
- A float representation of the object.
- Throws:
ImproperTypeException
- if the value cannot be unboxed or converted.- See Also:
-
asD
Attempts to unbox or convert a value to a double.- Parameters:
obj
- An object to unbox.- Returns:
- A double representation of the object.
- Throws:
ImproperTypeException
- if the value cannot be unboxed or converted.- See Also:
-
asZ
Attempts to unbox or convert a value to a boolean.- Parameters:
obj
- An object to unbox.- Returns:
- A boolean representation of the object.
- See Also:
-