Java Doc for Runtime.java in  » Parser » Rats-Parser-Generators » xtc » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Parser » Rats Parser Generators » xtc.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   xtc.util.Runtime

Runtime
public class Runtime (Code)
A tool's runtime. This helper class processes command line options, prints errors and warnings, and manages console output.
author:
   Robert Grimm
version:
   $Revision: 1.27 $


Field Summary
final public static  StringINPUT_DIRECTORY
     The internal name for the input directory option.
final public static  StringINPUT_ENCODING
     The internal name for the intput encoding option.
final public static  StringOUTPUT_DIRECTORY
     The internal name for the output directory option.
final public static  StringOUTPUT_ENCODING
     The internal name for the output encoding option.
protected  Printerconsole
     The console printer.
protected  PrintererrConsole
     The error console printer.
protected  interrors
     The error count.
final protected  Map<String, Option>externalMap
     The map from external names to options.
final protected  Map<String, Option>internalMap
     The map from internal names to options.
final protected  List<Option>optionList
     The list of command line options.
final protected  Map<String, Object>options
     The actual options.
protected  intwarnings
     The warning count.

Constructor Summary
public  Runtime()
     Create a new runtime.

Method Summary
protected  voidadd(Option option)
     Add the specified option.
public  Runtimeatt(String external, String internal, boolean multiple, String description)
     Declare an attribute-valued command line option.
public  Runtimebool(String external, String internal, boolean value, String description)
     Declare a boolean command line option.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
Parameters:
  value - The default value.
Parameters:
  description - The description.
protected  voidcheck(String external, String internal)
     Check that no option with the specified names exits.
protected  voidcheck(Option option, Object value)
     Check that the specified value is valid for the specified option.
public  Printerconsole()
     Get a printer to the console.
public  Runtimedir(String external, String internal, boolean multiple, String description)
     Declare a directory-valued command line option.
public  PrintererrConsole()
     Get a printer to the error console.
public  voiderror()
     Record an error reported through another means.
public  voiderror(String msg)
     Print the specified error message.
public  voiderror(String msg, Node n)
     Print the specified error message.
public  interrorCount()
     Get the current error count.
public  voidexit()
     Exit the tool.
public  Runtimefile(String external, String internal, boolean multiple, String description)
     Declare a file-valued command line option.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
Parameters:
  multiple - The flag for multiple occurrences.
Parameters:
  description - The description.
public  longfreeMemory()
     Get an estimate of free memory.
public  List<Attribute>getAttributeList(String name)
     Get the attribute list value of the specified option.
Parameters:
  name - The internal name.
public  FilegetFile(String name)
     Get the file value of the specified option.
Parameters:
  name - The internal name.
public  List<File>getFileList(String name)
     Get the file list value of the specified option.
Parameters:
  name - The internal name.
public  intgetInt(String name)
     Get the integer value of the specified option.
Parameters:
  name - The internal name.
public  ListgetList(String name)
     Get the list value of the specified option.
Parameters:
  name - The internal name.
public  FilegetOutputDirectory()
     Get this runtime's output directory.
public  ReadergetReader(File file)
     Get a reader for the specified file.
public  ReadergetReader(InputStream in)
     Get a reader for the specified input stream.
public  StringgetString(String name)
     Get the string value of the specified option.
Parameters:
  name - The internal name.
public  ObjectgetValue(String name)
     Get the value of the specified option.
Parameters:
  name - The internal name.
public  WritergetWriter(File file)
     Get a writer for the specified file.
public  WritergetWriter(OutputStream in)
     Get a writer for the specified output stream.
public  booleanhasPrefixValue(String prefix)
     Determine whether any option with the specified prefix has a value.
Parameters:
  prefix - The prefix.
public  booleanhasValue(String name)
     Determine whether the specified option has a value.
Parameters:
  name - The internal name.
public  voidinitDefaultValues()
     Initialize all options without values to their defaults.
public  voidinitFlags(boolean value)
     Initialize all boolean options without values to the specified value.
public  voidinitFlags(String prefix, boolean value)
     Initialize all boolean options with the specified prefix and without values to the specified value.
public  Filelocate(String path)
     Locate the specified file.
public  Runtimenumber(String external, String internal, int value, String description)
     Declare an integer-valued command line option.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
Parameters:
  value - The default value.
Parameters:
  description - The description.
public  voidprintOptions()
     Print a description of all command line options to the console.
public  intprocess(String args)
     Process the specified command line arguments.
public  booleanseenError()
     Determine whether errors have been reported.
public  voidsetConsole(Printer console)
     Update the printer to the console.
public  voidsetErrConsole(Printer console)
     Update the printer to the error console.
public  voidsetValue(String name, Object value)
     Set the value of the specified option.
public  voidsetValue(String name, boolean value)
     Set the value of the specified boolean-valued option.
public  booleantest(String name)
     Test the value of the specified boolean option.
Parameters:
  name - The internal name.
public  voidwarning()
     Record a warning reported through another means.
public  voidwarning(String msg)
     Print the specified warning message.
public  voidwarning(String msg, Node n)
     Print the specified warning message.
public  Runtimeword(String external, String internal, boolean multiple, String description)
     Declare a word-valued command line option.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
Parameters:
  multiple - The flag for multiple occurrences.
Parameters:
  description - The description.
throws:
  IllegalArgumentException - Signals that an option withthe external or interal name already exists.

Field Detail
INPUT_DIRECTORY
final public static String INPUT_DIRECTORY(Code)
The internal name for the input directory option. The option is expected to have multiple directory values.



INPUT_ENCODING
final public static String INPUT_ENCODING(Code)
The internal name for the intput encoding option. The option is expected to have a word value.



OUTPUT_DIRECTORY
final public static String OUTPUT_DIRECTORY(Code)
The internal name for the output directory option. The option is expected to have a directory value.



OUTPUT_ENCODING
final public static String OUTPUT_ENCODING(Code)
The internal name for the output encoding option. The option is expected to have a word value.



console
protected Printer console(Code)
The console printer.



errConsole
protected Printer errConsole(Code)
The error console printer.



errors
protected int errors(Code)
The error count.



externalMap
final protected Map<String, Option> externalMap(Code)
The map from external names to options.



internalMap
final protected Map<String, Option> internalMap(Code)
The map from internal names to options.



optionList
final protected List<Option> optionList(Code)
The list of command line options.



options
final protected Map<String, Object> options(Code)
The actual options.



warnings
protected int warnings(Code)
The warning count.




Constructor Detail
Runtime
public Runtime()(Code)
Create a new runtime. Note that the list of input directories is empty, while the output directory is initialized to the current directory.




Method Detail
add
protected void add(Option option)(Code)
Add the specified option. This method adds the specified option to the Runtime.optionList , Runtime.externalMap , and Runtime.internalMap fields.
Parameters:
  option - The option.



att
public Runtime att(String external, String internal, boolean multiple, String description)(Code)
Declare an attribute-valued command line option.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
Parameters:
  multiple - The flag for multiple occurrences.
Parameters:
  description - The description.
throws:
  IllegalArgumentException - Signals that an option withthe external or interal name already exists.



bool
public Runtime bool(String external, String internal, boolean value, String description)(Code)
Declare a boolean command line option.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
Parameters:
  value - The default value.
Parameters:
  description - The description. This runtime.
throws:
  IllegalArgumentException - Signals that an option withthe external or interal name already exists.



check
protected void check(String external, String internal)(Code)
Check that no option with the specified names exits.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
throws:
  IllegalArgumentException - Signals that an option withthe external or interal name already exists.



check
protected void check(Option option, Object value)(Code)
Check that the specified value is valid for the specified option.
Parameters:
  option - The option.
Parameters:
  value - The value.
throws:
  IllegalArgumentException - Signals that the value isinvalid.



console
public Printer console()(Code)
Get a printer to the console. A printer to the console.



dir
public Runtime dir(String external, String internal, boolean multiple, String description)(Code)
Declare a directory-valued command line option. The default value is the current directory.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
Parameters:
  multiple - The flag for multiple occurrences.
Parameters:
  description - The description. This runtime.
throws:
  IllegalArgumentException - Signals that an option withthe external or interal name already exists.



errConsole
public Printer errConsole()(Code)
Get a printer to the error console. A printer to the error console.



error
public void error()(Code)
Record an error reported through another means.



error
public void error(String msg)(Code)
Print the specified error message.
Parameters:
  msg - The error message.



error
public void error(String msg, Node n)(Code)
Print the specified error message.
Parameters:
  msg - The error message.
Parameters:
  n - The offending node.



errorCount
public int errorCount()(Code)
Get the current error count. The current error count.



exit
public void exit()(Code)
Exit the tool. This method terminates the Java virtual machine with the appropriate exit code and a summary of error and warning numbers if any have been reported.



file
public Runtime file(String external, String internal, boolean multiple, String description)(Code)
Declare a file-valued command line option.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
Parameters:
  multiple - The flag for multiple occurrences.
Parameters:
  description - The description. This runtime.
throws:
  IllegalArgumentException - Signals that an option withthe external or interal name already exists.



freeMemory
public long freeMemory()(Code)
Get an estimate of free memory. An estimate of free memory.



getAttributeList
public List<Attribute> getAttributeList(String name)(Code)
Get the attribute list value of the specified option.
Parameters:
  name - The internal name. The option's attribute list value.
throws:
  IllegalArgumentException - Signals that the correspondingoption has no value.
throws:
  ClassCastException - Signals that the corresponding optiondoes not have an attribute list value.



getFile
public File getFile(String name)(Code)
Get the file value of the specified option.
Parameters:
  name - The internal name. The option's file value.
throws:
  IllegalArgumentException - Signals that the correspondingoption has no value.
throws:
  ClassCastException - Signals that the corresponding optiondoes not have a file value.



getFileList
public List<File> getFileList(String name)(Code)
Get the file list value of the specified option.
Parameters:
  name - The internal name. The option's file list value.
throws:
  IllegalArgumentException - Signals that the correspondingoption has no value.
throws:
  ClassCastException - Signals that the corresponding optiondoes not have a file list value.



getInt
public int getInt(String name)(Code)
Get the integer value of the specified option.
Parameters:
  name - The internal name. The option's integer value.
throws:
  IllegalArgumentException - Signals that the correspondingoption has no value.
throws:
  ClassCastException - Signals that the corresponding optiondoes not have an integer value.



getList
public List getList(String name)(Code)
Get the list value of the specified option.
Parameters:
  name - The internal name. The option's list value.
throws:
  IllegalArgumentException - Signals that the correspondingoption has no value.
throws:
  ClassCastException - Signals that the corresponding optiondoes not have a list value.



getOutputDirectory
public File getOutputDirectory()(Code)
Get this runtime's output directory.
See Also:   Runtime.OUTPUT_DIRECTORY The output directory.



getReader
public Reader getReader(File file) throws IOException(Code)
Get a reader for the specified file. The reader uses this runtime's input encoding and is buffered.
See Also:   Runtime.INPUT_ENCODING
Parameters:
  file - The file. The corresponding reader.
throws:
  IOException - Signals an I/O error.



getReader
public Reader getReader(InputStream in) throws UnsupportedEncodingException(Code)
Get a reader for the specified input stream. The reader uses this runtime's input encoding and is buffered.
See Also:   Runtime.INPUT_ENCODING
Parameters:
  in - The input stream. The corresponding reader.
throws:
  UnsupportedEncodingException - Signals that this runtime's encoding is not valid.



getString
public String getString(String name)(Code)
Get the string value of the specified option.
Parameters:
  name - The internal name. The option's string value.
throws:
  IllegalArgumentException - Signals that the correspondingoption has no value.
throws:
  ClassCastException - Signals that the corresponding optiondoes not have an integer value.



getValue
public Object getValue(String name)(Code)
Get the value of the specified option.
Parameters:
  name - The internal name. The option's value.
throws:
  IllegalArgumentException - Signals that the option has novalue.



getWriter
public Writer getWriter(File file) throws IOException(Code)
Get a writer for the specified file. The writer uses this runtime's output encoding and is buffered.
See Also:   Runtime.OUTPUT_ENCODING
Parameters:
  file - The file. The corresponding writer.
throws:
  IOException - Signals an I/O error.



getWriter
public Writer getWriter(OutputStream in) throws UnsupportedEncodingException(Code)
Get a writer for the specified output stream. The writer uses this runtime's output encoding and is buffered.
See Also:   Runtime.OUTPUT_ENCODING
Parameters:
  in - The output stream. The corresponding writer.
throws:
  UnsupportedEncodingException - Signals that this runtime's encoding is not valid.



hasPrefixValue
public boolean hasPrefixValue(String prefix)(Code)
Determine whether any option with the specified prefix has a value.
Parameters:
  prefix - The prefix. true if any option with the prefix has avalue.



hasValue
public boolean hasValue(String name)(Code)
Determine whether the specified option has a value.
Parameters:
  name - The internal name. true if the option has a value.



initDefaultValues
public void initDefaultValues()(Code)
Initialize all options without values to their defaults. The default value for word, file, and attribute options is null if no multiple occurrences are allowed and the empty list otherwise.



initFlags
public void initFlags(boolean value)(Code)
Initialize all boolean options without values to the specified value.
Parameters:
  value - The value.



initFlags
public void initFlags(String prefix, boolean value)(Code)
Initialize all boolean options with the specified prefix and without values to the specified value.
Parameters:
  prefix - The prefix.
Parameters:
  value - The value.



locate
public File locate(String path) throws FileNotFoundException(Code)
Locate the specified file. This method searches this runtime's list of input directories.
See Also:   Runtime.INPUT_DIRECTORY
Parameters:
  path - The (relative) file path. The corresponding file.
throws:
  FileNotFoundException - Signals that the specified file could not be found.



number
public Runtime number(String external, String internal, int value, String description)(Code)
Declare an integer-valued command line option.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
Parameters:
  value - The default value.
Parameters:
  description - The description. This runtime.
throws:
  IllegalArgumentException - Signals that an option withthe external or interal name already exists.



printOptions
public void printOptions()(Code)
Print a description of all command line options to the console.



process
public int process(String args)(Code)
Process the specified command line arguments. This method sets all options to their specified values.
Parameters:
  args - The arguments. The index right after the processed command line options.



seenError
public boolean seenError()(Code)
Determine whether errors have been reported. true if errors have been reported.



setConsole
public void setConsole(Printer console)(Code)
Update the printer to the console. Since the console is used throughout xtc, use this method with caution.
Parameters:
  console - The new console.



setErrConsole
public void setErrConsole(Printer console)(Code)
Update the printer to the error console. Since the error console is used throughout xtc, use this method with caution.
Parameters:
  console - The new error console.



setValue
public void setValue(String name, Object value)(Code)
Set the value of the specified option.
Parameters:
  name - The internal name.
Parameters:
  value - The value.
throws:
  IllegalArgumentException - Signals an unrecognized optionor an invalid value.



setValue
public void setValue(String name, boolean value)(Code)
Set the value of the specified boolean-valued option.
Parameters:
  name - The internal name.
Parameters:
  value - The value.
throws:
  IllegalArgumentException - Signals an unrecognized optionor not a boolean-valued option.



test
public boolean test(String name)(Code)
Test the value of the specified boolean option.
Parameters:
  name - The internal name. The option's boolean value.
throws:
  IllegalArgumentException - Signals that the correspondingoption has no value.
throws:
  ClassCastException - Signals that the corresponding optiondoes not have a boolean value.



warning
public void warning()(Code)
Record a warning reported through another means.



warning
public void warning(String msg)(Code)
Print the specified warning message.
Parameters:
  msg - The warning message.



warning
public void warning(String msg, Node n)(Code)
Print the specified warning message.
Parameters:
  msg - The warning message.
Parameters:
  n - The offending node.



word
public Runtime word(String external, String internal, boolean multiple, String description)(Code)
Declare a word-valued command line option.
Parameters:
  external - The external name.
Parameters:
  internal - The internal name.
Parameters:
  multiple - The flag for multiple occurrences.
Parameters:
  description - The description.
throws:
  IllegalArgumentException - Signals that an option withthe external or interal name already exists. This runtime.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.