|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xbn.XBNObject | +--xbn.template.TemplateLineAnalyzer
For every line found in a template, this class retrieves surrounding text and gaps.
Source code: TemplateLineAnalyzer.java
Configuration for this class is held in a TParseConfig.
Note that, for speed and efficiency, gaps are validated on the fly, one at a time, as they are retrieved. You will successfully retrieve the first three gaps contained in the line, even when the fourth one is illegally formatted.
Fields inherited from class xbn.XBNObject |
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP |
Constructor Summary | |
TemplateLineAnalyzer(StringBuffer sb_line)
Create an TemplateLineAnalyzer. |
|
TemplateLineAnalyzer(String s_templateName,
int i_lineNumber,
StringBuffer sb_line)
Create an TemplateLineAnalyzer. |
|
TemplateLineAnalyzer(String s_templateName,
int i_lineNumber,
StringBuffer sb_line,
TLAObjects tla_objects)
Create an TemplateLineAnalyzer. |
|
TemplateLineAnalyzer(String s_templateName,
int i_lineNumber,
StringBuffer sb_line,
TParseConfig tp_config)
Create an TemplateLineAnalyzer. |
Method Summary | |
int |
getCharArrIdx()
Get the current character array index. |
String |
getFinalSurrTxt()
Get the final surrounding text, after all surrounding-text-and-gaps have been retrieved. |
GapConfig |
getGapConfig()
Get the GapConfig for direct manipulation. |
int |
getLineNumber()
Get the current line number. |
s_s |
getNextSurrTxtAndGap()
Get the next surrounding text and gap. |
String |
getTemplateName()
Get the name of the template being analyzed. |
TParseConfig |
getTParseConfig()
Get the TParseConfig for direct manipulation. |
boolean |
hasAnotherGap()
Is there another gap in the line, yet to be retrieved? |
boolean |
isDoneAnalyzing()
Has this line been completely analyzed? |
Methods inherited from class xbn.XBNObject |
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TemplateLineAnalyzer(StringBuffer sb_line) throws TemplateFormatException
Create an TemplateLineAnalyzer.
Equal to TParseConfig(null, -1, sb_line, new TParseConfig())
This constructor is intended for testing purposes only. When using this class for real, it is recommended that you use the TLAObjects version of this class' constructors.
public TemplateLineAnalyzer(String s_templateName, int i_lineNumber, StringBuffer sb_line) throws TemplateFormatException
Create an TemplateLineAnalyzer.
Equal to TParseConfig(s_templateName, i_lineNumber, sb_line, (new TParseConfig()))
public TemplateLineAnalyzer(String s_templateName, int i_lineNumber, StringBuffer sb_line, TParseConfig tp_config) throws TemplateFormatException
Create an TemplateLineAnalyzer.
Equal to TemplateLineAnalyzer(s_templateName, i_lineNumber, sb_line, (new TLAObjects(tp_config))
This constructor is intended for testing purposes only. When using this class for real, it is recommended that you use the TLAObjects version of this class' constructors.
public TemplateLineAnalyzer(String s_templateName, int i_lineNumber, StringBuffer sb_line, TLAObjects tla_objects) throws TemplateFormatException
Create an TemplateLineAnalyzer.
s_templateName
- The name of the template being analyzed, for debugging purposes only.i_lineNumber
- The current line number, for debugging purposes only. Should be greater than zero, but not enforced.sb_line
- A single line of text that may or may not contain a gap. May not be null.tla_objects
- The TLAObjects, containing some of the internal objects needed by this class, as well as the TParseConfig, which defines what a gap is.AssertException
- If sb_line contains a line separator.Method Detail |
public final TParseConfig getTParseConfig()
Get the TParseConfig for direct manipulation.
public final GapConfig getGapConfig()
Get the GapConfig for direct manipulation.
getTParseConfig().getGapConfig()
public final int getLineNumber()
Get the current line number.
public final String getTemplateName()
Get the name of the template being analyzed.
public final int getCharArrIdx()
Get the current character array index.
public final boolean isDoneAnalyzing()
Has this line been completely analyzed?
Sanity check: When this returns true, hasAnotherGap equals false, getTemplateName equals null and getLineNumber and getCharArrIdx equal -1.
false If there is at least one more surrounding-text-and-gap, or the final surrounding text has not yet been retrieved.
Sanity chock: When this returns false, hasAnotherGap may equal either true or false, getTemplateName and getLineNumber equal [whatever was provided to the constructor] and and getCharArrIdx equals [something greater than -1].
public final boolean hasAnotherGap()
Is there another gap in the line, yet to be retrieved?
public s_s getNextSurrTxtAndGap() throws TemplateFormatException
Get the next surrounding text and gap.
AssertException
- If hasAnotherGap equals false.public String getFinalSurrTxt()
Get the final surrounding text, after all surrounding-text-and-gaps have been retrieved.
AssertException
- If either hasAnotherGap or isDoneAnalyzing equal true.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
http://sourceforge.net/projects/xbnjava