net.sf.saffron.util
Class Util

java.lang.Object
  |
  +--openjava.mop.Toolbox
        |
        +--net.sf.saffron.util.Util

public class Util
extends Toolbox

Miscellaneous utility functions.


Nested Class Summary
static class Util.UtilTestCase
           
 
Nested classes inherited from class openjava.mop.Toolbox
Toolbox.StopIterationException
 
Field Summary
static PrintWriter debugWriter
           
static Object[] emptyObjectArray
           
static String[] emptyStringArray
           
static String fileSeparator
          System-dependent file separator, for example, "/" or "\."
static String lineSeparator
          System-dependent newline character.
 
Fields inherited from class openjava.mop.Toolbox
clazzAggAndAcc, clazzAggregationExtender, clazzClass, clazzCollection, clazzComparable, clazzComparator, clazzConnection, clazzEntry, clazzEnumeration, clazzHashtable, clazzIterable, clazzIterator, clazzMap, clazzMapEntry, clazzObject, clazzObjectArray, clazzResultSet, clazzSaffronUtil, clazzSet, clazzSQLException, clazzString, clazzSyntheticObject, clazzVector, clazzVoid, emptyArrayOfOJClass
 
Constructor Summary
Util()
           
 
Method Summary
static Expression clone(Expression exp)
           
static Expression[] clone(Expression[] a)
           
static int[] clone(int[] a)
           
static StatementList clone(StatementList e)
           
static String[] clone(String[] a)
           
static void discard(int i)
           
static void discard(Object o)
           
static boolean equal(String s0, String s1)
          Returns whether two strings are equal or are both null.
static boolean equals(int[] a, int[] b)
          Returns whether two integer arrays are equal.
static int hash(int i, int j)
           
(package private) static boolean isStatic(Member member)
           
static void main(String[] args)
          Runs the test suite.
static Set minus(Set set1, Set set2)
          Return a set of the elements which are in set1 but not in set2, without modifying either.
static double nLogN(double d)
          Computes nlogn(n) (or n if n is small, so the result is never negative.
static void print(PrintWriter pw, Object o)
          Print an object using reflection.
static void print(PrintWriter pw, Object o, int indent)
           
static void printJavaString(PrintWriter pw, String s, boolean nullMeansNull)
          Prints a string, enclosing in double quotes (") and escaping if necessary.
static void println(PrintWriter pw, Object o)
           
static String replace(String s, String find, String replace)
          Replaces every occurrence of find in s with replace.
static String stripDoubleQuotes(String value)
          Converts double-quoted Java strings to their contents.
static Test suite()
           
static Object[] toArray(Vector v)
          Deprecated. use Vector.toArray() on Java2
static Object[] toArray(Vector v, Object[] a)
          Equivalent to Vector.toArray(Object[]).
static URL toURL(File file)
          Creates a file-protocol URL for the given file.
 
Methods inherited from class openjava.mop.Toolbox
append, append, append, append, arrayForNames, box, castObject, forNameAnyway, generateParameters, generateParameters, getAlias, getRowType, getTable, getType, getType, getTypes, go, go, guessRowType, guessRowType, isAcceptable, isAdaptableTo, isEquals, isSame, lookupAnonymousClass, makeEquals, nameForJavaClassName, nameToJavaClassName, needToImplement, newInternal, newInternal, newInternal, newInternal, overridesOn, overridesOn, overridesOn, pickupAcceptableConstructor, pickupAcceptableConstructors, pickupAcceptableMethod, pickupAcceptableMethods, pickupAcceptableMethodsByParameterTypes, pickupConstructor, pickupField, pickupMethod, pickupMethodByParameterTypes, pickupMethodsByName, pickupMostSpecified, pickupMostSpecified, pre, removeTheDefaults, removeTheDefaults, removeTheDefaults, removeTheDefaults, removeTheNonPublics, removeTheNonPublics, removeTheNonPublics, removeTheNonPublics, removeThePrivates, removeThePrivates, removeThePrivates, removeThePrivates, TNsForOJClasses, toArray, toList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineSeparator

public static String lineSeparator
System-dependent newline character.


fileSeparator

public static String fileSeparator
System-dependent file separator, for example, "/" or "\."


debugWriter

public static PrintWriter debugWriter

emptyObjectArray

public static final Object[] emptyObjectArray

emptyStringArray

public static final String[] emptyStringArray
Constructor Detail

Util

public Util()
Method Detail

discard

public static final void discard(Object o)

discard

public static final void discard(int i)

equal

public static final boolean equal(String s0,
                                  String s1)
Returns whether two strings are equal or are both null.


clone

public static StatementList clone(StatementList e)

clone

public static String[] clone(String[] a)

clone

public static int[] clone(int[] a)

equals

public static boolean equals(int[] a,
                             int[] b)
Returns whether two integer arrays are equal. Neither must be null.


hash

public static int hash(int i,
                       int j)

main

public static void main(String[] args)
                 throws Exception
Runs the test suite.

Exception

minus

public static Set minus(Set set1,
                        Set set2)
Return a set of the elements which are in set1 but not in set2, without modifying either.


nLogN

public static double nLogN(double d)
Computes nlogn(n) (or n if n is small, so the result is never negative.


print

public static void print(PrintWriter pw,
                         Object o)
Print an object using reflection. We can handle null; arrays of objects and primitive values; for regular objects, we print all public fields.


print

public static void print(PrintWriter pw,
                         Object o,
                         int indent)

printJavaString

public static final void printJavaString(PrintWriter pw,
                                         String s,
                                         boolean nullMeansNull)
Prints a string, enclosing in double quotes (") and escaping if necessary. For examples, printDoubleQuoted(w,"x\"y",false) prints "x\"y".


println

public static void println(PrintWriter pw,
                           Object o)

replace

public static final String replace(String s,
                                   String find,
                                   String replace)
Replaces every occurrence of find in s with replace.


toURL

public static URL toURL(File file)
                 throws MalformedURLException
Creates a file-protocol URL for the given file.

MalformedURLException

clone

public static Expression clone(Expression exp)

clone

public static Expression[] clone(Expression[] a)

stripDoubleQuotes

public static String stripDoubleQuotes(String value)
Converts double-quoted Java strings to their contents. For example, "foo\"bar" becomes foo"bar.


suite

public static Test suite()
                  throws Exception
Exception

toArray

public static Object[] toArray(Vector v)
Deprecated. use Vector.toArray() on Java2


toArray

public static Object[] toArray(Vector v,
                               Object[] a)
Equivalent to Vector.toArray(Object[]).


isStatic

static boolean isStatic(Member member)

SourceForge.net_Logo