Module Simula

Class Util

java.lang.Object
simula.compiler.utilities.Util

public final class Util extends Object
A set of all static Utility Methods

Link to GitHub: Source File.

Author:
Øystein Myhre Andersen
  • Field Details

    • nError

      public static int nError
      Number of error messages.
  • Constructor Details

    • Util

      Util()
      Default constructor.
  • Method Details

    • popUpMessage

      public static void popUpMessage(Object msg)
      Pop up a message box.
      Parameters:
      msg - the message
    • popUpError

      public static void popUpError(String msg)
      Pop up an error message box.
      Parameters:
      msg - the error message
    • optionDialog

      public static int optionDialog(Object msg, String title, int optionType, int messageType, String... option)
      Brings up an option dialog.
      Parameters:
      msg - the message to display
      title - the title string for the dialog
      optionType - an integer designating the options available on the dialog
      messageType - an integer designating the kind of message this is
      option - an array of objects indicating the possible choices the user can make
      Returns:
      an integer indicating the option chosen by the user, or CLOSED_OPTION if the user closed the dialog
    • error

      public static void error(String msg)
      Print a error message.
      Parameters:
      msg - the message
    • IERR

      public static void IERR(String msg)
      Print a internal error message.
      Parameters:
      msg - the message
    • FORCED_EXIT

      private static void FORCED_EXIT()
      Perform FORCED EXIT.
    • IERR

      public static void IERR(String msg, Throwable e)
      Print a internal error message.
      Parameters:
      msg - the message
      e - any Throwable
    • warning

      public static void warning(String msg)
      Print a warning message.
      Parameters:
      msg - the message
    • edLINE

      private static String edLINE(String s)
      Edit a line with source line number etc.
      Parameters:
      s - the line string
      Returns:
      the resulting string
    • TRACE

      public static void TRACE(String msg)
      Utility method: TRACE
      Parameters:
      msg - the message to print
    • TRACE_OUTPUT

      public static void TRACE_OUTPUT(String msg)
      Utility method: TRACE_OUTPUT
      Parameters:
      msg - the message to print
    • TRACE_INPUT

      public static void TRACE_INPUT(String msg)
      Utility method: TRACE_INPUT
      Parameters:
      msg - the message to print
    • ASSERT

      public static void ASSERT(boolean test, String msg)
      Utility method: ASSERT
      Parameters:
      test - this test must be true
      msg - the message when test = false
    • println

      public static void println(String s)
      Print a string.
      Parameters:
      s - the string
    • printError

      public static void printError(String s)
      Print a error message.
      Parameters:
      s - the message
    • printWarning

      public static void printWarning(String s)
      Print a warning message.
      Parameters:
      s - the message
    • isJavaIdentifier

      public static boolean isJavaIdentifier(String ident)
      Check if 'ident' is a legal Java Identifier.
      Parameters:
      ident - the given identifier
      Returns:
      true if 'ident' is a legal Java Identifier otherwise false
    • makeJavaIdentifier

      public static String makeJavaIdentifier(String ident)
      Make 'ident' a legal Java Identifier.
      Parameters:
      ident - the given identifier
      Returns:
      the resulting Java identifier
    • equals

      public static boolean equals(String s1, String s2)
      Returns true if the two specified strings are equal to one another.
      Parameters:
      s1 - argument string
      s2 - argument string
      Returns:
      true if the two specified strings are equal to one another
    • IPOW

      public static int IPOW(long base, long x)
      Utility: Integer Power: b ** x
      Parameters:
      base - argument base
      x - argument x
      Returns:
      Returns the value of 'base' raised to the power of 'x'