Class UtilityFunctions

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

public class UtilityFunctions extends 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 Details

    • newMagicBean

      public static Object newMagicBean()
    • logError

      public static void logError(String message)
    • logInfo

      public static void logInfo(String message)
    • logDebug

      public static void logDebug(String message)
    • undef

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

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

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

      public static Boolean isNull(Object s)
      Parameters:
      s - is some value or object
      Returns:
      true if the parameter is null
    • 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 Long getByte(byte[] buffer, Long i)
    • setByte

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

      public static byte[] getStringBytes(String s)
    • stringifyBuffer

      public static String stringifyBuffer(byte[] buffer)
    • length

      public static Long length(Object arg)
    • cdbl

      public static Double cdbl(Object arg) throws BasicRuntimeException
      Throws:
      BasicRuntimeException
    • clng

      public static Long clng(Object arg) throws BasicRuntimeException
      Throws:
      BasicRuntimeException
    • chr

      public static String chr(Object charcode) throws BasicRuntimeException
      Returns a String containing the character associated with the specified character code.
      Parameters:
      charcode - argument is a Long that identifies a character
      Returns:
      character
      Throws:
      BasicRuntimeException - fail if incorrect character code
    • asc

      public static Integer asc(Object arg) throws BasicRuntimeException
      Returns an Integer representing the character code corresponding to the first letter in a string.
      Parameters:
      arg - string argument
      Returns:
      character code corresponding to the first letter
      Throws:
      BasicRuntimeException - fail on empty input