Dave Jarvis' Repositories

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

Formatting of JOIN statements.

Author Dave Jarvis <email>
Date 2015-03-14 15:48:51 GMT-0700
Commit 1086c144fce8dc7054ecfa0a09c07a8058f879db
Parent 23f348a
Delta 22 lines added, 17 lines removed, 5-line increase
source/java/com/whitemagicsoftware/rxm/QueryBuilder.java
*/
private String getFromClause() {
- return "person person";
+ return " person person";
}
source/java/com/whitemagicsoftware/rxm/tree/TransformationTree.java
*/
public String toString() {
- return toString( this, getIndent() );
+ return toString( this, getIndentBy() );
}
for( Tree<T> branch : tree.getBranches() ) {
// Recurse for all the branches at this level of the tree.
- sb.append( newline ).append( toString( branch, depth + getIndent() ) );
+ sb.append( newline ).append( toString( branch, depth + getIndentBy() ) );
}
* @param spaces The number of spaces to add to the string.
*/
- private String getIndent( int spaces ) {
+ protected String getIndent( int spaces ) {
return CharBuffer.allocate( spaces ).toString().replace( '\0', ' ' );
}
/**
- * Returns the indent value.
+ * Returns the number of spaces to indent by.
*
* @return 2 (by default)
*/
- protected int getIndent() {
+ protected int getIndentBy() {
return INDENT;
}
source/java/com/whitemagicsoftware/rxm/tree/xml/JoinMapContext.java
@Override
public Token getStart() {
- ParserRuleContext ctx = getParserRuleContext();
-
- String table = getTableName();
+ return new Token( String.format( "%s JOIN %s ON",
+ getJoinType(),
+ getTableName() )
+ );
+ }
- return new Token( String.format( "%s JOIN %s", getJoinType(), table ) );
+ /**
+ * Returns the ending text for an OUTER JOIN clause.
+ */
+ @Override
+ public Token getStop() {
+ String s;
+
+ return new Token( "" );
}
return tableColumn().column();
}
-
- protected abstract QueryParser.TableColumnContext tableColumn();
/**
- * Returns the ending text for an OUTER JOIN clause.
+ * Returns the left-hand-side table name, which is the implied JOIN
+ * table.
*/
- @Override
- public Token getStop() {
- return new Token( "" );
- }
+ protected abstract QueryParser.TableColumnContext tableColumn();
}