| | +package com.whitemagicsoftware.rxm.tree; |
| | + |
| | +import com.whitemagicsoftware.rxm.grammar.QueryParser; |
| | + |
| | +import org.antlr.v4.runtime.ParserRuleContext; |
| | +import org.antlr.v4.runtime.Token; |
| | + |
| | +/** |
| | + * The wrapper class for ParserRuleContext. This class uses an implicit |
| | + * factory technique to derive the |
| | + */ |
| | +public class Payload extends ParserRuleContext { |
| | + /** Wrapped parser rule context instance. */ |
| | + private ParserRuleContext ctx; |
| | + |
| | + private Tree<Payload> tree; |
| | + |
| | + public Payload( ParserRuleContext ctx ) { |
| | + setParserRuleContext( ctx ); |
| | + } |
| | + |
| | + @Override |
| | + public Token getStart() { |
| | + //System.out.println( getTree().getClass().getPackage().getName() ); |
| | + //System.out.println( getParserRuleContext().getClass().getSimpleName() ); |
| | + return getParserRuleContext().getStart(); |
| | + } |
| | + |
| | + @Override |
| | + public Token getStop() { |
| | + return getParserRuleContext().getStop(); |
| | + } |
| | + |
| | + /** |
| | + * Allows subclasses to retrieve the payload. |
| | + * |
| | + * @return The original (unwrapped) payload. |
| | + */ |
| | + protected ParserRuleContext getParserRuleContext() { |
| | + return this.ctx; |
| | + } |
| | + |
| | + /** |
| | + * Sets the payload. |
| | + * |
| | + * @param ctx The original (unwrapped) payload. |
| | + */ |
| | + private void setParserRuleContext( ParserRuleContext ctx ) { |
| | + this.ctx = ctx; |
| | + } |
| | + |
| | + public void setTree( Tree<Payload> tree ) { |
| | + this.tree = tree; |
| | + } |
| | + |
| | + public Tree<Payload> getTree() { |
| | + return this.tree; |
| | + } |
| | +} |
| | + |
| | |