Class UtilityFunctions

java.lang.Object
com.scriptbasic.utility.functions.UtilityFunctions

public class UtilityFunctions
extends java.lang.Object
Static methods in this class are registered in the interpreter when the interpreter starts. The interpreter calls the static method MethodRegisterUtility.registerFunctions(Class, Interpreter) and that function registers the methods in this class with their own name so that BASIC programs can call the functions like BASIC built in functions.
Author:
Peter Verhas date July 15, 2012
  • Method Summary

    Modifier and Type Method Description
    static byte[] byteBuffer​(int len)
    Create a new byte buffer of length len.
    static java.lang.Long getByte​(byte[] buffer, java.lang.Long i)  
    static byte[] getStringBytes​(java.lang.String s)  
    static java.lang.Boolean isDefined​(java.lang.Object s)  
    static java.lang.Boolean isUndef​(java.lang.Object s)  
    static java.lang.Long length​(java.lang.Object arg)  
    static void logDebug​(java.lang.String message)  
    static void logError​(java.lang.String message)  
    static void logInfo​(java.lang.String message)  
    static java.lang.Object newMagicBean()  
    static void setByte​(byte[] buffer, java.lang.Long i, java.lang.Long v)  
    static java.lang.String stringifyBuffer​(byte[] buffer)  
    static java.lang.Object undef()
    This function returns the undef value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • newMagicBean

      public static java.lang.Object newMagicBean()
    • logError

      public static void logError​(java.lang.String message)
    • logInfo

      public static void logInfo​(java.lang.String message)
    • logDebug

      public static void logDebug​(java.lang.String message)
    • undef

      public static java.lang.Object undef()
      This function returns the undef value.
      Returns:
      the undef value
    • isUndef

      public static java.lang.Boolean isUndef​(java.lang.Object s)
      Parameters:
      s - is some value or object
      Returns:
      true if the parameter is undefined
    • isDefined

      public static java.lang.Boolean isDefined​(java.lang.Object s)
      Parameters:
      s - is some value or object
      Returns:
      true if the parameter is defined (not isUndef).
    • byteBuffer

      public static byte[] byteBuffer​(int len)
      Create a new byte buffer of length len.
      Parameters:
      len - the length of the buffer allocated.
      Returns:
      the new buffer
    • getByte

      public static java.lang.Long getByte​(byte[] buffer, java.lang.Long i)
    • setByte

      public static void setByte​(byte[] buffer, java.lang.Long i, java.lang.Long v) throws BasicRuntimeException
      Throws:
      BasicRuntimeException
    • getStringBytes

      public static byte[] getStringBytes​(java.lang.String s)
    • stringifyBuffer

      public static java.lang.String stringifyBuffer​(byte[] buffer)
    • length

      public static java.lang.Long length​(java.lang.Object arg)