|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.codegen.kernel.CodeGeneratorUtilities
public class CodeGeneratorUtilities
Utilities that are useful for code generators.
Red (cxh) |
Green (cxh) |
Constructor Summary | |
---|---|
CodeGeneratorUtilities()
|
Method Summary | |
---|---|
static java.util.HashMap |
newMap(NamedObj namedObj)
Given a NamedObj, generate a HashMap containing String key/value pairs where each key is a Variable contained in the namedObj argument, and each value is the value of the Variable. |
static java.io.BufferedReader |
openAsFileOrURL(java.lang.String inputFileName)
Given a string that names a file, URL or resource, try to open as a file, and then as a URL, then as a resource. |
static void |
substitute(java.io.BufferedReader inputFile,
java.util.Map substituteMap,
java.lang.String outputFileName)
Read in the contents of inputFile, and replace each matching String key found in substituteMap with the corresponding String value and write the results to outputFileName. |
static java.lang.String |
substitute(java.lang.String input,
java.util.Map substituteMap)
Given a string and a Map containing String key/value pairs, substitute any keys found in the input with the corresponding values. |
static void |
substitute(java.lang.String inputFileName,
java.util.Map substituteMap,
java.lang.String outputFileName)
Read in the contents of inputFileName, and replace each matching String key found in substituteMap with the corresponding String value and write the results to outputFileName. |
static java.lang.String |
substitute(java.lang.String inputFileName,
NamedObj namedObj)
Read in the contents of inputFileName, and for each Parameter in namedObj, search for strings like @ParameterName@ in inputFileName, and
substitute in the value of the Parameter and return the results. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CodeGeneratorUtilities()
Method Detail |
---|
public static java.util.HashMap newMap(NamedObj namedObj) throws IllegalActionException
namedObj
- The NamedObj that contains Variables
IllegalActionException
- If there is a problem getting the
Variables.public static java.io.BufferedReader openAsFileOrURL(java.lang.String inputFileName) throws java.io.FileNotFoundException, java.io.IOException
inputFileName
- The name of the file or URL to open
java.io.FileNotFoundException
- If the file cannot be found.
java.io.IOException
- If there were problems creating
the BufferedReader.public static java.lang.String substitute(java.lang.String input, java.util.Map substituteMap)
input
- The input string that contains substrings
like "@codeBase@".substituteMap
- The Map of String keys like "@codeBase@"
and String values like "../../..".
public static java.lang.String substitute(java.lang.String inputFileName, NamedObj namedObj) throws java.io.FileNotFoundException, java.io.IOException
@ParameterName@
in inputFileName, and
substitute in the value of the Parameter and return the results.
inputFileName
- The name of the file to read from.namedObj
- The NamedObj that contains Parameters to
be searched for in inputFileName.
java.io.FileNotFoundException
- If the input file cannot be found.
java.io.IOException
- If there is a problem creating the
substitution map.public static void substitute(java.io.BufferedReader inputFile, java.util.Map substituteMap, java.lang.String outputFileName) throws java.io.FileNotFoundException, java.io.IOException
inputFile
- A BufferedReader that refers to the file to be
read in. This BufferedReader is always closed by this method.substituteMap
- The Map of String keys like "@codeBase@"
and String values like "../../..".outputFileName
- The name of the file to write to.
java.io.FileNotFoundException
- If the input file cannot be found.
java.io.IOException
- If there is a problem creating the
substitution map.substitute(String, Map, String)
public static void substitute(java.lang.String inputFileName, java.util.Map substituteMap, java.lang.String outputFileName) throws java.io.FileNotFoundException, java.io.IOException
inputFileName
- The name of the file to read from.substituteMap
- The Map of String keys like "@codeBase@"
and String values like "../../..".outputFileName
- The name of the file to write to.
java.io.FileNotFoundException
- If the input file cannot be found.
java.io.IOException
- If there is a problem creating the
substitution map.substitute(BufferedReader, Map, String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |