at.dms.util
Class Utils

java.lang.Object
  |
  +--at.dms.util.Utils
Direct Known Subclasses:
CContext, CFieldTable, CMember, CodeSequence, CStdType, CThrowableInfo, CTopLevel, CType, KjcPrettyPrinter, Phylum, SignatureParser

public abstract class Utils
extends java.lang.Object

This class defines severals utilities methods used in source code.


Field Summary
static int DBG_LEVEL_HIGH
          High debug output/overhead.
static int DBG_LEVEL_LOW
          Low debug output/overhead.
static int DBG_LEVEL_NO
          No debugging.
 
Constructor Summary
Utils()
           
 
Method Summary
static void assert(boolean b)
          Check if an assertion is valid.
static void assert(boolean b, java.lang.String message)
          Check if an assertion is valid.
static void fail()
          Throws an error.
static void fail(java.lang.String message)
          Throws an error.
static boolean hasFlag(int modifiers, int flag)
          Whether the specified flag is enabled in modifiers.
static boolean hasMoreThanOneFlag(int modifiers, int flags)
          Whether modifiers has more than one of the flags set.
static boolean hasOtherFlags(int modifiers, int flags)
          Whether other flags than the specified one are enabled in modifiers.
static java.lang.String[] splitQualifiedName(java.lang.String name)
          Splits a string like: "java/lang/System/out" into two strings: "java/lang/System" and "out"
static java.lang.String[] splitQualifiedName(java.lang.String name, char separator)
          Splits a string like: "java/lang/System/out" into two strings: "java/lang/System" and "out"
static java.lang.Object[] vectorToArray(java.util.Vector vect, java.lang.Class type)
          Creates a typed array from a vector.
static int[] vectorToIntArray(java.util.Vector vect)
          Creates a int array from a vector.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBG_LEVEL_NO

public static final int DBG_LEVEL_NO
No debugging.

DBG_LEVEL_LOW

public static final int DBG_LEVEL_LOW
Low debug output/overhead.

DBG_LEVEL_HIGH

public static final int DBG_LEVEL_HIGH
High debug output/overhead.
Constructor Detail

Utils

public Utils()
Method Detail

assert

public static final void assert(boolean b,
                                java.lang.String message)
Check if an assertion is valid.
Throws:
java.lang.RuntimeException - If assertion fails, this exception with the specified message as its message is thrown.

fail

public static final void fail(java.lang.String message)
Throws an error.
Throws:
java.lang.RuntimeException - This exception with the specified message as its message is thrown.

assert

public static final void assert(boolean b)
Check if an assertion is valid.
Throws:
java.lang.RuntimeException - If assertion fails, this exception with a default message is thrown.

fail

public static final void fail()
Throws an error.
Throws:
java.lang.RuntimeException - This exception with a default message is thrown.

hasMoreThanOneFlag

public static boolean hasMoreThanOneFlag(int modifiers,
                                         int flags)
Whether modifiers has more than one of the flags set.
Returns:
whether modifiers has more than one of the flags set.

hasFlag

public static boolean hasFlag(int modifiers,
                              int flag)
Whether the specified flag is enabled in modifiers.
Returns:
the specified flag is enabled in modifiers.

hasOtherFlags

public static boolean hasOtherFlags(int modifiers,
                                    int flags)
Whether other flags than the specified one are enabled in modifiers.
Returns:
other flags than the specified one are enabled in modifiers.

vectorToArray

public static java.lang.Object[] vectorToArray(java.util.Vector vect,
                                               java.lang.Class type)
Creates a typed array from a vector.
Parameters:
vect - The vector containing the elements.
type - The type of the elements.

vectorToIntArray

public static int[] vectorToIntArray(java.util.Vector vect)
Creates a int array from a vector.
Parameters:
vect - The vector containing the elements.
type - The type of the elements.

splitQualifiedName

public static java.lang.String[] splitQualifiedName(java.lang.String name,
                                                    char separator)
Splits a string like: "java/lang/System/out" into two strings: "java/lang/System" and "out"

splitQualifiedName

public static java.lang.String[] splitQualifiedName(java.lang.String name)
Splits a string like: "java/lang/System/out" into two strings: "java/lang/System" and "out"