|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.opmath.util.dmldoc.DMLDocBlock
The Document Object Model (DOM) for the SGML template.
DMLDocBlock is a unit of the DMLDoc: this unit is
roughly equivalent to a block of program code. Thus, it can represent the complete
DOM, or some part of the DOM such as a LOOP or IF / IFNOT / IFDATAFOR / IFNODATAFOR
component. DMLDocBlocks can be nested recursively.
A DMLDocBlock contains one or more DMLDocText
components. Each of these components is responsible for one one SUB value,
and its preceeding text.
Copyright: (c) 2002 The Open Math Company Limited
The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.
DMLDoc,
DMLDocText| Field Summary | |
protected static String |
CMD_ENDIF
The String identifying the DMLDoc ENDIF command. |
protected static String |
CMD_ENDLOOP
The String identifying the DMLDoc ENDLOOP command. |
protected static String |
CMD_IF
The String identifying the DMLDoc IF command. |
protected static String |
CMD_IFDATA
The String identifying the DMLDoc IFDATAFOR command. |
protected static String |
CMD_IFNODATA
The String identifying the DMLDoc IFNODATAFOR
command. |
protected static String |
CMD_IFNOT
The String identifying the DMLDoc IFNOT command. |
protected static String |
CMD_LOOP
The String identifying the DMLDoc LOOP command. |
protected static String |
CMD_SUB
The String identifying the DMLDoc SUB command. |
protected static String |
DELIMITERS
The delimiters used to identify the DMLDoc command tokens in the template source. |
protected static String |
EOL
The end-of-line character or characters for the server operating system. |
| Constructor Summary | |
|
DMLDocBlock()
Constructs an empty DMLDocBlock node. |
|
DMLDocBlock(BufferedReader viewReader)
Constructs a DMLDocBlock node for a given input text, and
with a given DMLDocBlock parent node. |
protected |
DMLDocBlock(BufferedReader viewReader,
DMLDocBlock newParent,
ParseCounter countLOOP,
ParseCounter countIF)
Constructs a DMLDocBlock for a given source text, and with
a given DMLDocBlock parent node. |
protected |
DMLDocBlock(BufferedReader viewReader,
DMLDocBlock newParent,
String ifToken,
ParseCounter countLOOP,
ParseCounter countIF)
Constructs a DMLDocBlock for a given source text, and with
a given DMLDocBlock parent node. |
| Method Summary | |
protected void |
parse(BufferedReader viewReader)
Constructs the DMLDocBlock according to the text supplied
by the given BufferedReader. |
String |
toString()
Returns a formatted string representaion of the DMLDocBlock
instance. |
String |
view(ComparableTable model)
Returns a String representaion of the DMLDocBlock
instance, with the various SUBs, LOOPs and IF / IFNOT / IFDATAFOR / IFNODATAFOR
elements processed, as determined by the contents of the
com.opmath.util.datastruct.ComparableTable. |
protected String |
view(ComparableTable model,
int mode,
int loopIndex)
Returns a String representaion of the DMLDocBlock
instance, with the various SUBs, LOOPs and IF / IFNOT / IFDATAFOR / IFNODATAFOR
elements processed, as determined by the contents of the
com.opmath.util.datastruct.ComparableTable. |
ComparableList |
viewNames()
Returns a ComparableList containing one Object
for each of the SUB and IF / IFNOT / IFDATAFOR / IFNODATAFOR source names
found in the SGML template file. |
protected ComparableList |
viewNames(ComparableList sourceList)
Updates the com.opmath.util.datastruct.ComparableList with
one Object for each of the SUB and IF / IFNOT / IFDATAFOR /
IFNODATAFOR sources found in the SGML template file (if any). |
String |
viewWithException(ComparableTable model)
Returns a String representaion of the DMLDocBlock
instance, with the various SUBs, LOOPs and IF / IFNOT / IFDATAFOR / IFNODATAFOR
elements processed, as determined by the contents of the
com.opmath.util.datastruct.ComparableTable. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected static final String DELIMITERS
The delimiters used to identify the DMLDoc command tokens in the template source. Used by the DMLDoc parser.
Set to "\t\n\r #/|%,.;:'?=&\"<>[]{}".
protected static final String EOL
The end-of-line character or characters for the server operating system. Used by the DMLDoc parser, instantiator, and exception reporting methods.
Set to System.getProperty("line.separator").
protected static final String CMD_SUB
The String identifying the DMLDoc SUB command.
Used by the parser. Note that this parser is not case-sensitive for these
commands.
Set to "SUB".
protected static final String CMD_IF
The String identifying the DMLDoc IF command.
Used by the parser. Note that this parser is not case-sensitive for these
commands.
Set to "IF".
protected static final String CMD_IFNOT
The String identifying the DMLDoc IFNOT command.
Used by the parser. Note that this parser is not case-sensitive for these
commands.
Set to "IFNOT".
protected static final String CMD_IFDATA
The String identifying the DMLDoc IFDATAFOR command.
Used by the parser. Note that this parser is not case-sensitive for these
commands.
Set to "IFDATAFOR".
protected static final String CMD_IFNODATA
The String identifying the DMLDoc IFNODATAFOR
command. Used by the parser. Note that this parser is not case-sensitive
for these commands.
Set to "IFNODATAFOR".
protected static final String CMD_ENDIF
The String identifying the DMLDoc ENDIF command.
Used by the parser. Note that this parser is not case-sensitive for these
commands.
Set to "ENDIF".
protected static final String CMD_LOOP
The String identifying the DMLDoc LOOP command.
Used by the parser. Note that this parser is not case-sensitive for these
commands.
Set to "LOOP".
protected static final String CMD_ENDLOOP
The String identifying the DMLDoc ENDLOOP command.
Used by the parser. Note that this parser is not case-sensitive for these
commands.
Set to "ENDLOOP".
| Constructor Detail |
protected DMLDocBlock(BufferedReader viewReader,
DMLDocBlock newParent,
String ifToken,
ParseCounter countLOOP,
ParseCounter countIF)
throws DMLDocBuildException
Constructs a DMLDocBlock for a given source text, and with
a given DMLDocBlock parent node.
NOTE: It is anticipated that DMLDoc(String, String) will be the
most common way in which DMLDocBlock instances are created.
viewReader - a BufferedReader carrying the source text.newParent - the DMLDocBlock which will be the parent of this new node.ifToken - the String naming the IF / IFNOT determiner.countLOOP - the ParseCounter used to measure LOOP balance.countIF - the ParseCounter used to measure IF / IFNOT balance.DMLDocBuildException - An exception thrown if
the source text contained malformed commands.DMLDocBlock(String,String)
protected DMLDocBlock(BufferedReader viewReader,
DMLDocBlock newParent,
ParseCounter countLOOP,
ParseCounter countIF)
throws DMLDocBuildException
Constructs a DMLDocBlock for a given source text, and with
a given DMLDocBlock parent node.
DMLDoc(String, String) will be the
most common way in which DMLDocBlock instances are created.viewReader - a BufferedReader carrying the source text.newParent - the DMLDocBlock which will be the parent of this new node.countLOOP - the ParseCounter used to measure LOOP balance.countIF - the ParseCounter used to measure IF balance.DMLDocBuildException - An exception thrown if
the source text contained malformed commands.DMLDocBlock(String,String)
public DMLDocBlock(BufferedReader viewReader)
throws DMLDocBuildException
Constructs a DMLDocBlock node for a given input text, and
with a given DMLDocBlock parent node.
NOTE: It is anticipated that DMLDoc(String, String) will be the
most common way in which DMLDocBlock instances are created.
viewReader - the BufferedReader for the template file.DMLDocBuildException - An exception thrown if
the source text contained malformed commands.DMLDocBlock(String,String)public DMLDocBlock()
Constructs an empty DMLDocBlock node.
NOTE: It is anticipated that DMLDoc(String, String) will be the
most common way in which DMLDocBlock instances are created.
DMLDocBlock(String,String)| Method Detail |
protected ComparableList viewNames(ComparableList sourceList)
Updates the com.opmath.util.datastruct.ComparableList with
one Object for each of the SUB and IF / IFNOT / IFDATAFOR /
IFNODATAFOR sources found in the SGML template file (if any).
It is anticipated that the alternative method - viewNames() -
will be the normal way in which DMLDocBlock view sources are
found.
sourceList - the ComparableList for the SUB and
IF / IFNOT / IFDATAFOR / IFNODATAFOR source names.ComparableList of source names.viewNames(com.opmath.util.datastruct.ComparableList),
DMLDocText.viewNames(com.opmath.util.datastruct.ComparableList)public ComparableList viewNames()
Returns a ComparableList containing one Object
for each of the SUB and IF / IFNOT / IFDATAFOR / IFNODATAFOR source names
found in the SGML template file.
If no substitution sources were found, viewNames() returns a
ComparableList with zero elements.
ComparableList of source names.
protected void parse(BufferedReader viewReader)
throws DMLDocBuildException
Constructs the DMLDocBlock according to the text supplied
by the given BufferedReader. If the source text contains
malformed commands, parse(BufferedReader) throws a
DMLDocBuildException.
viewReader - a BufferedReader carrying the source text.ComparableList of source names.DMLDocBuildException - An exception thrown if
the source text contained malformed commands.
protected String view(ComparableTable model,
int mode,
int loopIndex)
throws DMLDocWriteException
Returns a String representaion of the DMLDocBlock
instance, with the various SUBs, LOOPs and IF / IFNOT / IFDATAFOR / IFNODATAFOR
elements processed, as determined by the contents of the
com.opmath.util.datastruct.ComparableTable.
NOTE: This is a highly specialzed method, only called during recursive decents into the DOM.
model - the com.opmath.util.datastruct.ComparableTable representing the data set.mode - the int representing the function of this DMLDocBlock.loopIndex - the int representing the current row in the model.String containing the instantiated DMLDocBlock.DMLDocWriteException - An exception thrown if
the com.opmath.util.datastruct.ComparableTable was malformed.view(com.opmath.util.datastruct.ComparableTable)
public String viewWithException(ComparableTable model)
throws DMLDocWriteException
Returns a String representaion of the DMLDocBlock
instance, with the various SUBs, LOOPs and IF / IFNOT / IFDATAFOR / IFNODATAFOR
elements processed, as determined by the contents of the
com.opmath.util.datastruct.ComparableTable.
If the com.opmath.util.datastruct.ComparableTable is malformed,
viewWithException(com.opmath.util.datastruct.ComparableTable)
raises a DMLDocWriteException exception.
model - the com.opmath.util.datastruct.ComparableTable
representing the data set.String containing the instantiated DMLDocBlock.DMLDocWriteException - An exception thrown if
the com.opmath.util.datastruct.ComparableTable was malformed.view(com.opmath.util.datastruct.ComparableTable)public String view(ComparableTable model)
Returns a String representaion of the DMLDocBlock
instance, with the various SUBs, LOOPs and IF / IFNOT / IFDATAFOR / IFNODATAFOR
elements processed, as determined by the contents of the
com.opmath.util.datastruct.ComparableTable.
If the com.opmath.util.datastruct.ComparableTable is malformed,
view(com.opmath.util.datastruct.ComparableTable) attempts to
return a String containing an SGML-formatted report detailing
the cause of the problem. The template resource for this report is held
at com.opmath.util.dmldoc.tpl_DMLDocWriteException.html This
template may be edited, but all of its <!-- SUB .. -->
commands should remain unaltered.
NOTE: If com.opmath.util.dmldoc.tpl_DMLDocWriteException.html
is not found, or is malformed, then
view(com.opmath.util.datastruct.ComparableTable) reports to
System.err and returns an empty String.
model - the com.opmath.util.datastruct.ComparableTable
representing the data set.String containing the instantiated SGML template.public String toString()
Returns a formatted string representaion of the DMLDocBlock
instance. No instantiation is performed, but the structure of the
DMLDocBlockinstance is revealed.
NOTE: Intended to be used for debugging tasks only. The format of the
output may change from one release of dmldoc to the next.
toString in class ObjectStringview(com.opmath.util.datastruct.ComparableTable)
|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||