Dave Jarvis' Repositories

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

Added missing classes needed for JOINs.

AuthorDave Jarvis <email>
Date2015-03-14 14:26:18 GMT-0700
Commit85ba2faa7323b9b51b0505aed383bce0dd3f2364
Parenta36f9fb
source/java/com/whitemagicsoftware/rxm/tree/xml/JoinMapContext.java
+package com.whitemagicsoftware.rxm.tree.xml;
+
+import com.whitemagicsoftware.rxm.grammar.QueryParser;
+import com.whitemagicsoftware.rxm.tree.Payload;
+import com.whitemagicsoftware.rxm.tree.Token;
+
+import org.antlr.v4.runtime.ParserRuleContext;
+
+/**
+ * Superclass for common behaviour between INNER and OUTER JOIN clauses.
+ */
+public abstract class JoinMapContext extends PayloadParserRuleContext {
+ /**
+ * Default constructor (calls super).
+ *
+ * @param initPayload The payload that associates the parser rule context
+ * with the abstract syntax tree.
+ */
+ public JoinMapContext( Payload initPayload ) {
+ super( initPayload);
+ }
+
+ public abstract String getJoinType();
+
+ /**
+ * Returns the starting text for an OUTER JOIN clause.
+ */
+ @Override
+ public Token getStart() {
+ ParserRuleContext ctx = getParserRuleContext();
+
+
+
+ return new Token( String.format( "%s JOIN %s", getJoinType(), ctx.getText() ) );
+ }
+
+ /**
+ * Returns the ending text for an OUTER JOIN clause.
+ */
+ @Override
+ public Token getStop() {
+ return new Token( "" );
+ }
+}
+
source/java/com/whitemagicsoftware/rxm/tree/xml/OuterMapContext.java
+package com.whitemagicsoftware.rxm.tree.xml;
+
+import com.whitemagicsoftware.rxm.grammar.QueryParser;
+import com.whitemagicsoftware.rxm.tree.Payload;
+import com.whitemagicsoftware.rxm.tree.Token;
+import com.whitemagicsoftware.rxm.tree.Tree;
+
+import org.antlr.v4.runtime.ParserRuleContext;
+
+/**
+ * Transforms <b><code>table.column -&gt; table.column</code></b> into a SQL
+ * <code>OUTER JOIN</code> expression.
+ */
+public class OuterMapContext extends JoinMapContext {
+ /**
+ * Default constructor (calls super).
+ *
+ * @param ctx The payload that associates the parser rule context with
+ * the abstract syntax tree.
+ */
+ public OuterMapContext( Payload ctx ) {
+ super( ctx );
+ }
+
+ public String getJoinType() {
+ return "OUTER";
+ }
+}
+
Delta74 lines added, 0 lines removed, 74-line increase