| Author | Dave Jarvis <email> |
|---|---|
| Date | 2015-03-08 20:26:10 GMT-0700 |
| Commit | 5d7b186a027fd048e1c1100cb792434f0d3d90a7 |
| Parent | 550161e |
| /** | ||
| - * Invoked when parsing <code>table > path</code>. Adds a new leaf to | ||
| - * the context tree, then changes the context tree to the newly added leaf. | ||
| + * Invoked when parsing <b><code>table > path</code></b>. Adds a new | ||
| + * leaf to the context tree, then changes the context tree to the newly | ||
| + * added leaf. | ||
| * | ||
| * @param ctx The payload to transform. | ||
| */ | ||
| @Override | ||
| public synchronized void enterTableMap( QueryParser.TableMapContext ctx ) { | ||
| setContextTree( addLeaf( ctx ) ); | ||
| } | ||
| /** | ||
| - * Invoked when parsing <code>column > path</code>. Adds a new leaf to | ||
| - * the context tree. | ||
| + * Invoked when parsing <b><code>column > path</code></b>. Adds a new | ||
| + * leaf to the context tree. | ||
| * | ||
| * @param ctx The payload to transform. | ||
| */ | ||
| @Override | ||
| public synchronized void enterColumnMap( QueryParser.ColumnMapContext ctx ) { | ||
| addLeaf( ctx ); | ||
| } | ||
| /** | ||
| - * Invoked when parsing <code>column > attribute</code>. Adds a new leaf | ||
| - * to the context tree. | ||
| + * Invoked when parsing <b><code>column > attribute</code></b>. Adds | ||
| + * a new leaf to the context tree. | ||
| * | ||
| * @param ctx The payload to transform. | ||
| /** | ||
| - * Invoked when parsing <code>^</code>. Changes context tree to its parent. | ||
| - * If the parent doesn't exist, this will fail silently. | ||
| + * Invoked when parsing <b><code>^</code></b>. Changes context tree to | ||
| + * its parent. If the parent doesn't exist, this will fail silently. | ||
| * | ||
| * @param ctx Indicates that context should switch, has no payload. | ||
| } | ||
| + /** | ||
| + * Returns a message that denotes where the parsing problem was encountered. | ||
| + * | ||
| + * @return A non-null text string suitable for displaying to developers. | ||
| + */ | ||
| public String toString() { | ||
| return String.format( "Line: %s; near: \"%s\"; error: %s\n", |
| * </p> | ||
| * <p> | ||
| - * By virtue of the Tree being in the package with te *Context classes, | ||
| + * By virtue of the Tree being in the package with the *Context classes, | ||
| * the *Context class names themselves can be derived, and therefore | ||
| * instantiated. (The *Context class names directly correspond to QueryParser | ||
| private Tree<Payload> tree; | ||
| + /** | ||
| + * Sets the parser rule context, which is the payload that this class | ||
| + * wraps. | ||
| + * | ||
| + * @param ctx The payload. | ||
| + */ | ||
| public Payload( ParserRuleContext ctx ) { | ||
| setParserRuleContext( ctx ); | ||
| } | ||
| + /** | ||
| + * Calls the transformer to obtain its starting token. The starting token | ||
| + * is the transformed expression that directly corresponds to the payload | ||
| + * (i.e., the ParserRuleContext ctx instance). | ||
| + * | ||
| + * @return The opening transformed expression. | ||
| + */ | ||
| @Override | ||
| public Token getStart() { | ||
| return getTransformer().getStart(); | ||
| } | ||
| + /** | ||
| + * Calls the transformer to obtain its opening token. The opening token | ||
| + * is the transformed expression that directly corresponds to the payload | ||
| + * (i.e., the ParserRuleContext ctx instance). | ||
| + * | ||
| + * @return The closing transformed expression. | ||
| + */ | ||
| @Override | ||
| public Token getStop() { | ||
| } | ||
| + /** | ||
| + * Sets the abstract syntax tree for the point in the <b>rxm</b> that | ||
| + * relates to this payload. | ||
| + * | ||
| + * @param tree The tree that provides the document-specific output | ||
| + * generator. | ||
| + */ | ||
| public void setTree( Tree<Payload> tree ) { | ||
| this.tree = tree; | ||
| } | ||
| + /** | ||
| + * Returns the abstract syntax tree for the point in the <b>rxm</b> that | ||
| + * relates to this payload. | ||
| + * | ||
| + * @return The tree that provides the document-specific output generator. | ||
| + */ | ||
| public Tree<Payload> getTree() { | ||
| return this.tree; | ||
| /** | ||
| - * Depth-first traversal. This converts all payload instances in the tree | ||
| - * to their transformed equivalent. | ||
| + * This converts all payload instances in the tree to their transformed | ||
| + * equivalent using a depth-first traversal. | ||
| * | ||
| * @param tree The tree to transform. |
| /** | ||
| - * Transforms <code>table > @attribute</code>. | ||
| + * Transforms <b><code>table > @attribute</code></b> into an | ||
| + * <code>XMLATTRIBUTES</code> expression. | ||
| */ | ||
| public class AttributeMapContext extends PayloadParserRuleContext { | ||
| public AttributeMapContext( Payload ctx ) { | ||
| super( ctx ); | ||
| } | ||
| /** | ||
| - * Opens the XMLATTRIBUTES. | ||
| + * Opens the XMLATTRIBUTES expression. | ||
| + * | ||
| + * @return ",XMLATTRIBUTES(" ... | ||
| */ | ||
| @Override |
| /** | ||
| - * Transforms <code>column > path</code>. | ||
| + * Transforms <b><code>column > path</code></b> into an | ||
| + * <code>XMLELEMENT</code> expression. | ||
| */ | ||
| public class ColumnMapContext extends PayloadParserRuleContext { | ||
| public ColumnMapContext( Payload ctx ) { | ||
| super( ctx ); | ||
| } | ||
| /** | ||
| * Opens the XMLELEMENT. | ||
| + * | ||
| + * @return ",XMLELEMENT(" ... | ||
| */ | ||
| @Override |
| private Tree<Payload> tree; | ||
| + /** | ||
| + * Constructs a wrapper class that provides the ParserRuleContext and | ||
| + * tree for the *Context classes. | ||
| + * | ||
| + * @param payload The data that contains the ParserRuleContext and the | ||
| + * abstract syntax tree. | ||
| + */ | ||
| protected PayloadParserRuleContext( Payload payload ) { | ||
| this.payload = payload.getParserRuleContext(); | ||
| this.tree = payload.getTree(); | ||
| } | ||
| + /** | ||
| + * Returns the current payload. | ||
| + * | ||
| + * @return The payload containing tokens parsed from the input <b>rxm</b> | ||
| + * document. | ||
| + */ | ||
| protected ParserRuleContext getParserRuleContext() { | ||
| return this.payload; | ||
| /** | ||
| - * Closes the current payload transformation. Subclasses must override | ||
| - * this to provide the correct opening SQL/XML expression. | ||
| + * Opens the current transformation expression. Subclasses must override | ||
| + * this to provide the correct opening SQL/XML expression. It could be | ||
| + * made abstract, but is a useful convenience method. | ||
| * | ||
| - * @return The token text that makes up the start of a SQL/XML expression | ||
| - * (a left-parenthesis by default). | ||
| + * @return "(" | ||
| */ | ||
| @Override | ||
| public Token getStart() { | ||
| return new Token( "(" ); | ||
| } | ||
| /** | ||
| - * Closes the current payload transformation. Subclasses may override | ||
| + * Closes the current transformation expression. Subclasses may override | ||
| * this to provide a custom closing SQL/XML expression. | ||
| * | ||
| - * @return The token text that makes up the start of a SQL/XML expression | ||
| - * (a right-parenthesis by default). | ||
| + * @return ")" | ||
| */ | ||
| @Override | ||
| /** | ||
| - * Transforms <code>root > element</code>. | ||
| + * Transforms <b><code>root > element</code></b> into the starting | ||
| + * <code>SELECT</code> statement. | ||
| */ | ||
| public class RootContext extends PayloadParserRuleContext { | ||
| public RootContext( Payload ctx ) { | ||
| super( ctx ); | ||
| } | ||
| /** | ||
| * Transforms into SELECT, XMLROOT, and XMLELEMENT. | ||
| + * | ||
| + * @return "SELECT XMLROOT(" ... + ",XMLELEMENT(" ... | ||
| */ | ||
| @Override | ||
| /** | ||
| - * Closes the XMLROOT and XMLELEMENT. | ||
| + * Closes the XMLELEMENT and XMLROOT. | ||
| */ | ||
| @Override | ||
| /** | ||
| - * Returns the XML version number. | ||
| + * Returns the XML version number, used for the <code>VERSION</code> value. | ||
| * | ||
| * @return 1.0f by default. | ||
| */ | ||
| protected float getVersion() { | ||
| return 1.0f; | ||
| } | ||
| /** | ||
| - * Indicates the value for STANDALONE. | ||
| + * Indicates the value for <code>STANDALONE</code>. | ||
| * | ||
| - * @return true STANDALONE is set YES (false is NO). | ||
| + * @return <code>true</code> STANDALONE is set <code>YES</code>; | ||
| + * <code>false</code> STANDALONE is set <code>NO</code>. | ||
| */ | ||
| protected boolean isStandalone() { | ||
| /** | ||
| - * Transforms <code>table > path</code>. | ||
| + * Transforms <b><code>table > path</code></b> into an | ||
| + * <code>XMLELEMENT</code> expression. | ||
| */ | ||
| public class TableMapContext extends PayloadParserRuleContext { | ||
| public TableMapContext( Payload ctx ) { | ||
| super( ctx ); | ||
| } | ||
| /** | ||
| * Opens the XMLELEMENT. | ||
| + * | ||
| + * @return ",XMLELEMENT(" ... | ||
| */ | ||
| @Override |
| Delta | 91 lines added, 27 lines removed, 64-line increase |
|---|