story.dbcore.misc
Class Tools

java.lang.Object
  extended by story.dbcore.misc.Tools

public class Tools
extends java.lang.Object

Bag of miscellaneous tricks.


Constructor Summary
Tools()
           
 
Method Summary
static java.lang.StringBuffer indent(java.lang.StringBuffer in, java.lang.String indentation)
          Indent all the lines in a StringBuffer by a certain indentation string.
static void profile(java.lang.String functionName)
          Prints the current time to STDERR along with a message, presumably an identifier for a function in the code.
static java.lang.StringBuffer renderUnknownObject(java.lang.Object object)
          Render an object of class unknown (at compile time).
static boolean satisfies(java.lang.Class given, java.lang.String required)
          Determines if a given class satisfies a required class (by being the same or a subclass).
static java.util.Iterator sortFromEnumeration(java.util.Enumeration e)
          Sorts the elements accessible from an Enumeration by lexiographic order and returns an Iterator over the result.
static java.util.Iterator sortFromIterator(java.util.Iterator e)
          Sorts the elements accessible from an Iterator by lexiographic order and returns an Iterator over the result.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Tools

public Tools()
Method Detail

indent

public static java.lang.StringBuffer indent(java.lang.StringBuffer in,
                                            java.lang.String indentation)
                                     throws Scheherexception
Indent all the lines in a StringBuffer by a certain indentation string.

Throws:
Scheherexception

satisfies

public static boolean satisfies(java.lang.Class given,
                                java.lang.String required)
Determines if a given class satisfies a required class (by being the same or a subclass).


renderUnknownObject

public static java.lang.StringBuffer renderUnknownObject(java.lang.Object object)
                                                  throws Scheherexception
Render an object of class unknown (at compile time).

Throws:
Scheherexception

sortFromEnumeration

public static java.util.Iterator sortFromEnumeration(java.util.Enumeration e)
Sorts the elements accessible from an Enumeration by lexiographic order and returns an Iterator over the result.

Warning: This will throw a ClassCastException unless the objects you pass are of the same type, and that type implements Comparable.


sortFromIterator

public static java.util.Iterator sortFromIterator(java.util.Iterator e)
Sorts the elements accessible from an Iterator by lexiographic order and returns an Iterator over the result.

Warning: This will throw a ClassCastException unless the objects you pass are of the same type, and that type implements Comparable.


profile

public static void profile(java.lang.String functionName)
Prints the current time to STDERR along with a message, presumably an identifier for a function in the code. Used for profiling.



Copyright © 2011 David K. Elson. All Rights Reserved.