public class Generator extends Object
Copyright (c) 2013-2014 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights
reserved.
BSD-style license. See OpenTrafficSim License.
| Modifier and Type | Field and Description |
|---|---|
static valueclasses.generator.Generator.MathFunctionEntry[] |
mathFunctions
The math functions
|
| Constructor and Description |
|---|
Generator() |
| Modifier and Type | Method and Description |
|---|---|
static String |
buildField(String indent,
String field,
String description)
Create a String that describes one field.
|
static String |
buildMethod(String indent,
String qualifiersTypeAndName,
String description,
String[] params,
String exceptions,
String pragma,
String[] body,
boolean constructor)
Create a String that defines one method.
|
static void |
closeFile(BufferedWriter writer)
Close a file that was opened with openFile.
|
static void |
generateInterface(String relativePackage,
String name,
String[] imports,
String description,
String[] genericParams,
String typeInfo,
String body)
Write an interface file that defines an interface that does nothing but define it's own name.
|
static void |
main(String[] args)
Generate the code for the value classes.
|
static BufferedWriter |
openFile(String relativePackage,
String name,
String[] imports,
String description,
String[] genericParams)
Open a file and write the package line and initial block comment.
|
public static valueclasses.generator.Generator.MathFunctionEntry[] mathFunctions
public static BufferedWriter openFile(String relativePackage, String name, String[] imports, String description, String[] genericParams)
relativePackage - String; the last element(s) of the package namename - String; the name of the class file to writeimports - String[]; the imports for the new class filedescription - String; the description that is inserted in the block comment at the start of the filegenericParams - String[]; descriptions of the generic parameters of the classpublic static void closeFile(BufferedWriter writer)
writer - BufferedWriter; the result of the preceding call to openFilepublic static void generateInterface(String relativePackage, String name, String[] imports, String description, String[] genericParams, String typeInfo, String body)
relativePackage - String; the last element(s) of the package namename - String; the name of the class file to writeimports - String[]; the imports for the new class filedescription - String; the description that is inserted in the block comment at the start of the filegenericParams - String[]; the descriptions of the generic parameters of the classtypeInfo - String; the text that goes immediately after the class namebody - String; the body of the interface filepublic static String buildMethod(String indent, String qualifiersTypeAndName, String description, String[] params, String exceptions, String pragma, String[] body, boolean constructor)
indent - String; prefix for all output linesqualifiersTypeAndName - String; the qualifiers, the type and the name of the method separated by vertical
bars, e.g. final public|double|getDoubleValue. If this method overrides a method in a
parent class set this parameter to null.description - String; description of the methodparams - String[]; one String for each parameter of the method. Each parameter string consists of
qualifiers, type, name separated by vertical bars, e.g. final int|index|index of the
entryexceptions - String; exception type and description separated by a vertical bar, or null if this method does
not throw exceptionspragma - String; text that goes after the JavaDoc, but before the start of the method codebody - String[]; the lines of the body of the method. Lines on the outermost level should start with 0
spacesconstructor - boolean; if true; the new method is a constructor; if false; the new method is not a
constructorpublic static String buildField(String indent, String field, String description)
indent - String; prepended to each output linefield - String; the type and name of the fielddescription - String; the description of the fieldpublic static void main(String[] args)
args - String[]; the command line arguments (not used)Copyright © 2014 Delft University of Technology. All rights reserved.