|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavafe.Tool
Tool
is an abstract class for tools.
Tools are command-line applications invoked by calling their
static main(String[])
method.
Field Summary | |
static int |
badUsageExitCode
|
static int |
errorExitCode
|
static int |
okExitCode
Exit codes * |
static Options |
options
A statically held Options object. |
static int |
outOfMemoryExitCode
|
private static java.lang.Runtime |
rt
|
Constructor Summary | |
Tool()
|
Method Summary | |
void |
badOptionUsage(java.lang.Exception e)
|
static long |
currentTime()
|
static void |
main(java.lang.String[] args)
Start up an instance of this tool using command-line arguments args .
|
abstract java.lang.String |
name()
Return the non-null name of this tool. |
abstract int |
run(java.lang.String[] args)
A tool's main entry point; args are the
command-line arguments we have been invoked with. |
static java.lang.String |
spaceUsed()
|
static java.lang.String |
timeUsed(long startTime)
Compute the time used from a start time to now, then return it in a user readable form. |
void |
usage()
Print our usage message to System.err . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int okExitCode
public static final int badUsageExitCode
public static final int errorExitCode
public static final int outOfMemoryExitCode
public static Options options
private static java.lang.Runtime rt
Constructor Detail |
public Tool()
Method Detail |
public abstract java.lang.String name()
public void usage()
System.err
.
public void badOptionUsage(java.lang.Exception e)
public static void main(java.lang.String[] args)
args
.
Note: this code needs to be copied verbatim
to each subclass of Tool
except with the name of the
actual subclass inserted after the new operator and the comment
characters (//) removed.
(This needs to be done because static methods cannot be inherited.)
public abstract int run(java.lang.String[] args)
args
are the
command-line arguments we have been invoked with.
public static java.lang.String timeUsed(long startTime)
public static long currentTime()
public static java.lang.String spaceUsed()
|
ESC/Java2 © 2003,2004,2005 David Cok and Joseph Kiniry © 2005 UCD Dublin © 2003,2004 Radboud University Nijmegen © 1999,2000 Compaq Computer Corporation © 1997,1998,1999 Digital Equipment Corporation All Rights Reserved |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |