com.svincent.util
Class Util

java.lang.Object
  |
  +--com.svincent.util.Util

public class Util
extends java.lang.Object

The Util class is a useful little thingie which is an equivalent of the java.lang.System class. It contains miscellaneous utility methods which are useful in a wide variety of contexts.

Author:
Shawn Vincent

Field Summary
protected static char cNL
          self ISSUE: crappy.
static java.util.Comparator DefaultComparator
           
static java.lang.Class[] EmptyClassArray
           
static java.util.List EmptyList
          self ISSUE: Java does not allow us to make the *contents* of this list final through typing.
static java.lang.Object[] EmptyObjectArray
           
static java.lang.String[] EmptyStringArray
           
static java.io.PrintWriter err
          My version of java.lang.System.err.
static java.io.Reader in
          My version of java.lang.System.in.
static long MaxByte
           
static int MaxInt
           
static long MaxLong
           
static int MaxShort
           
static long MinByte
           
static int MinInt
           
static long MinLong
           
static int MinShort
           
static java.lang.String NL
          a newline for the current system.
static java.io.PrintWriter out
          My version of java.lang.System.out.
static java.util.Random random
          The current system random number generation.
 
Constructor Summary
protected Util()
          A protected no-arg constructor which just prevents people from creating instances of this class.
 
Method Summary
static void assert(boolean condition)
           
static void assert(boolean condition, java.lang.String msg)
           
static void assert(boolean condition, java.lang.String msg, java.lang.Throwable ex)
           
static int catHash(int hc, int v)
           
static int catHash(int hc, java.lang.Object o)
           
static int compare(java.util.Collection a, java.util.Collection b)
           
static int compare(java.util.Collection a, java.util.Collection b, java.util.Comparator c)
           
static int compare(java.lang.Object a, java.lang.Object b)
           
static java.lang.String dateAndTimeToString()
          Returns the current date and time in a nice String format.
static java.lang.String defaulttag(java.lang.Object o)
           
static void dump(java.io.PrintWriter out, int[] values)
          Dumps the given integer array.
static boolean equals(java.lang.Object a, java.lang.Object b)
           
static void indent(java.io.PrintWriter out)
           
static void indent(java.io.PrintWriter out, java.lang.String indentString)
           
static void main(java.lang.String[] argv)
           
static void outdent(java.io.PrintWriter out)
           
static void printStackTrace()
           
static java.lang.String readLine()
          Same as Util.readLine (Util.in).
static java.lang.String readLine(java.io.Reader in)
          Reads a string from the specified reader, stopping at newline (specified by Util.cNL).
static void setErr(java.io.PrintStream ps)
           
static void setErr(java.io.PrintWriter _err)
           
static void setIn(java.io.InputStream _in)
           
static void setIn(java.io.Reader _in)
           
static void setOut(java.io.PrintStream ps)
           
static void setOut(java.io.PrintWriter _out)
           
static void setRandom(java.util.Random _random)
          setRandom lets us set a new random number generator.
static void sleep(long milliseconds)
           
static void sleep(long milliseconds, int nanoseconds)
           
static void sleepSeconds(int seconds)
           
static java.lang.String stripQuotes(java.lang.String s)
           
static java.lang.String timetag(double seconds)
           
static java.lang.String timetag(long milliseconds)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EmptyList

public static final java.util.List EmptyList
self ISSUE: Java does not allow us to make the *contents* of this list final through typing. Make a custom subclass of list that is immutable for here.

EmptyObjectArray

public static final java.lang.Object[] EmptyObjectArray

EmptyClassArray

public static final java.lang.Class[] EmptyClassArray

EmptyStringArray

public static final java.lang.String[] EmptyStringArray

MinByte

public static final long MinByte

MaxByte

public static final long MaxByte

MinShort

public static final int MinShort

MaxShort

public static final int MaxShort

MinInt

public static final int MinInt

MaxInt

public static final int MaxInt

MinLong

public static final long MinLong

MaxLong

public static final long MaxLong

out

public static java.io.PrintWriter out
My version of java.lang.System.out. Made a PrintWriter so that JDK1.1 doesn't hate me with warnings.

err

public static java.io.PrintWriter err
My version of java.lang.System.err. Made a PrintWriter so that JDK1.1 doesn't hate me with warnings.

in

public static java.io.Reader in
My version of java.lang.System.in.

NL

public static final java.lang.String NL
a newline for the current system.

cNL

protected static final char cNL
self ISSUE: crappy. Remove this, and all references to this, in favor of Util.NL. Much nicer.

random

public static java.util.Random random
The current system random number generation. Simplifies the world, since we can just say Util.random.nextInt () instead of maintaining a random number generator ourselves.

DefaultComparator

public static java.util.Comparator DefaultComparator
Constructor Detail

Util

protected Util()
A protected no-arg constructor which just prevents people from creating instances of this class.
Method Detail

setOut

public static void setOut(java.io.PrintWriter _out)

setOut

public static void setOut(java.io.PrintStream ps)

setErr

public static void setErr(java.io.PrintWriter _err)

setErr

public static void setErr(java.io.PrintStream ps)

setIn

public static void setIn(java.io.Reader _in)

setIn

public static void setIn(java.io.InputStream _in)

defaulttag

public static java.lang.String defaulttag(java.lang.Object o)

indent

public static void indent(java.io.PrintWriter out)

indent

public static void indent(java.io.PrintWriter out,
                          java.lang.String indentString)

outdent

public static void outdent(java.io.PrintWriter out)

readLine

public static java.lang.String readLine(java.io.Reader in)
                                 throws java.io.IOException
Reads a string from the specified reader, stopping at newline (specified by Util.cNL). Supports Unicode, by virtue of using a Reader.

readLine

public static java.lang.String readLine()
                                 throws java.io.IOException
Same as Util.readLine (Util.in).

dateAndTimeToString

public static java.lang.String dateAndTimeToString()
Returns the current date and time in a nice String format.

timetag

public static java.lang.String timetag(double seconds)

timetag

public static java.lang.String timetag(long milliseconds)

catHash

public static int catHash(int hc,
                          int v)

catHash

public static int catHash(int hc,
                          java.lang.Object o)

stripQuotes

public static java.lang.String stripQuotes(java.lang.String s)

setRandom

public static void setRandom(java.util.Random _random)
setRandom lets us set a new random number generator. The com.randomX package is filled with them!

assert

public static void assert(boolean condition)

assert

public static void assert(boolean condition,
                          java.lang.String msg)

assert

public static void assert(boolean condition,
                          java.lang.String msg,
                          java.lang.Throwable ex)

printStackTrace

public static void printStackTrace()

dump

public static void dump(java.io.PrintWriter out,
                        int[] values)
Dumps the given integer array. XXX do stuff like 5 per line, etc.

sleepSeconds

public static void sleepSeconds(int seconds)

sleep

public static void sleep(long milliseconds)

sleep

public static void sleep(long milliseconds,
                         int nanoseconds)

compare

public static int compare(java.lang.Object a,
                          java.lang.Object b)

equals

public static boolean equals(java.lang.Object a,
                             java.lang.Object b)

compare

public static int compare(java.util.Collection a,
                          java.util.Collection b)

compare

public static int compare(java.util.Collection a,
                          java.util.Collection b,
                          java.util.Comparator c)

main

public static void main(java.lang.String[] argv)



This is documentation for Moksa Prolog, which can be found at http://www.svincent.com/moksa/

Copyright © 1999 Shawn P. Vincent.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.