Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/rxm.git

Updated source code comments.

AuthorDave Jarvis <email>
Date2015-03-08 20:26:10 GMT-0700
Commit5d7b186a027fd048e1c1100cb792434f0d3d90a7
Parent550161e
source/java/com/whitemagicsoftware/rxm/Parser.java
/**
- * Invoked when parsing <code>table &gt; 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 &gt; 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 &gt; path</code>. Adds a new leaf to
- * the context tree.
+ * Invoked when parsing <b><code>column &gt; 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 &gt; attribute</code>. Adds a new leaf
- * to the context tree.
+ * Invoked when parsing <b><code>column &gt; 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.
source/java/com/whitemagicsoftware/rxm/ParserException.java
}
+ /**
+ * 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",
source/java/com/whitemagicsoftware/rxm/tree/Payload.java
* </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;
source/java/com/whitemagicsoftware/rxm/tree/TransformationTree.java
/**
- * 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.
source/java/com/whitemagicsoftware/rxm/tree/xml/AttributeMapContext.java
/**
- * Transforms <code>table &gt; @attribute</code>.
+ * Transforms <b><code>table &gt; @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
source/java/com/whitemagicsoftware/rxm/tree/xml/ColumnMapContext.java
/**
- * Transforms <code>column &gt; path</code>.
+ * Transforms <b><code>column &gt; 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
source/java/com/whitemagicsoftware/rxm/tree/xml/PayloadParserRuleContext.java
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
source/java/com/whitemagicsoftware/rxm/tree/xml/RootContext.java
/**
- * Transforms <code>root &gt; element</code>.
+ * Transforms <b><code>root &gt; 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() {
source/java/com/whitemagicsoftware/rxm/tree/xml/TableMapContext.java
/**
- * Transforms <code>table &gt; path</code>.
+ * Transforms <b><code>table &gt; 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
Delta91 lines added, 27 lines removed, 64-line increase