diff --git a/client-ui/src/main/java/io/djigger/aggregation/DefaultPathTransformer.java b/client-ui/src/main/java/io/djigger/aggregation/DefaultPathTransformer.java index bab4ae3..cf2f4b2 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/DefaultPathTransformer.java +++ b/client-ui/src/main/java/io/djigger/aggregation/DefaultPathTransformer.java @@ -19,6 +19,7 @@ *******************************************************************************/ package io.djigger.aggregation; +import io.djigger.aggregation.filter.ContextAwareFilter; import io.djigger.aggregation.filter.Filter; import io.djigger.ui.model.NodeID; import io.djigger.ui.model.RealNode; @@ -42,6 +43,9 @@ public List transformPath(RealNode realTree, RealNodePath path) { List transformations = new ArrayList<>(path.getFullPath().size()); RealNode currentNode = realTree; + if(nodeFilter instanceof ContextAwareFilter) { + ((ContextAwareFilter)nodeFilter).startIteration(); + } for(NodeID nodeID:path.getFullPath()) { currentNode = currentNode.getChild(nodeID); if(nodeFilter == null || nodeFilter.isValid(nodeID)) { diff --git a/client-ui/src/main/java/io/djigger/aggregation/RevertTreePathTransformer.java b/client-ui/src/main/java/io/djigger/aggregation/RevertTreePathTransformer.java index f65ba17..4cdf38c 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/RevertTreePathTransformer.java +++ b/client-ui/src/main/java/io/djigger/aggregation/RevertTreePathTransformer.java @@ -19,6 +19,7 @@ *******************************************************************************/ package io.djigger.aggregation; +import io.djigger.aggregation.filter.ContextAwareFilter; import io.djigger.aggregation.filter.Filter; import io.djigger.ui.model.NodeID; import io.djigger.ui.model.RealNode; @@ -42,6 +43,9 @@ public List transformPath(RealNode realTree, RealNodePath path) { List transformations = new ArrayList<>(path.getFullPath().size()); RealNode currentNode = realTree; + if(nodeFilter instanceof ContextAwareFilter) { + ((ContextAwareFilter)nodeFilter).startIteration(); + } for(NodeID nodeID:path.getFullPath()) { currentNode = currentNode.getChild(nodeID); if(nodeFilter == null || nodeFilter.isValid(nodeID)) { diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/AndExpression.java b/client-ui/src/main/java/io/djigger/aggregation/filter/AndExpression.java index f84693e..fb4b3b2 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/AndExpression.java +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/AndExpression.java @@ -20,7 +20,7 @@ package io.djigger.aggregation.filter; -public class AndExpression implements Filter { +public class AndExpression implements Filter, ContextAwareFilter { private final Filter filter1; @@ -37,4 +37,24 @@ public boolean isValid(T input) { return filter1.isValid(input) && filter2.isValid(input); } + @Override + public void startIteration() { + if(filter1 instanceof ContextAwareFilter) { + ((ContextAwareFilter)filter1).startIteration(); + } + if(filter2 instanceof ContextAwareFilter) { + ((ContextAwareFilter)filter2).startIteration(); + } + } + + @Override + public void stopIteration() { + if(filter1 instanceof ContextAwareFilter) { + ((ContextAwareFilter)filter1).stopIteration(); + } + if(filter2 instanceof ContextAwareFilter) { + ((ContextAwareFilter)filter2).stopIteration(); + } + } + } diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/ContextAwareFilter.java b/client-ui/src/main/java/io/djigger/aggregation/filter/ContextAwareFilter.java new file mode 100644 index 0000000..3d52a61 --- /dev/null +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/ContextAwareFilter.java @@ -0,0 +1,8 @@ +package io.djigger.aggregation.filter; + +public interface ContextAwareFilter { + + public void startIteration(); + + public void stopIteration(); +} diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpression.g b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpression.g index cce80cc..6b0aa59 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpression.g +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpression.g @@ -5,7 +5,7 @@ header { class FilterExpressionLexer extends Lexer; // Words, which include our operators -WORD: ('a'..'z' | 'A'..'Z' | '0'..'9' |'.'|'$'|'_'|'-'|'<'|'>')+ ; +WORD: ('a'..'z' | 'A'..'Z' | '0'..'9' |'.'|'$'|'_'|'-'|'<'|'>'|':')+ ; // Grouping LEFT_PAREN: '('; diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexer.java b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexer.java index e215a47..835d8ee 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexer.java +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexer.java @@ -1,301 +1,307 @@ -// $ANTLR 2.7.7 (20060906): "FilterExpression.g" -> "FilterExpressionLexer.java"$ +// $ANTLR 2.7.7 (20060906): "FilterExpression.g" -> "FilterExpressionLexer.java"$ package io.djigger.aggregation.filter; - -import java.io.InputStream; -import antlr.TokenStreamException; -import antlr.TokenStreamIOException; -import antlr.TokenStreamRecognitionException; -import antlr.CharStreamException; -import antlr.CharStreamIOException; -import antlr.ANTLRException; -import java.io.Reader; -import java.util.Hashtable; -import antlr.CharScanner; -import antlr.InputBuffer; -import antlr.ByteBuffer; -import antlr.CharBuffer; -import antlr.Token; -import antlr.CommonToken; -import antlr.RecognitionException; -import antlr.NoViableAltForCharException; -import antlr.MismatchedCharException; -import antlr.TokenStream; -import antlr.ANTLRHashString; -import antlr.LexerSharedInputState; -import antlr.collections.impl.BitSet; -import antlr.SemanticException; - -public class FilterExpressionLexer extends antlr.CharScanner implements FilterExpressionLexerTokenTypes, TokenStream - { -public FilterExpressionLexer(InputStream in) { - this(new ByteBuffer(in)); -} -public FilterExpressionLexer(Reader in) { - this(new CharBuffer(in)); -} -public FilterExpressionLexer(InputBuffer ib) { - this(new LexerSharedInputState(ib)); -} -public FilterExpressionLexer(LexerSharedInputState state) { - super(state); - caseSensitiveLiterals = true; - setCaseSensitive(true); - literals = new Hashtable(); - literals.put(new ANTLRHashString("or", this), new Integer(9)); - literals.put(new ANTLRHashString("and", this), new Integer(10)); - literals.put(new ANTLRHashString("not", this), new Integer(11)); -} - -public Token nextToken() throws TokenStreamException { - Token theRetToken=null; -tryAgain: - for (;;) { - Token _token = null; - int _ttype = Token.INVALID_TYPE; - resetText(); - try { // for char stream error handling - try { // for lexical error handling - switch ( LA(1)) { - case '$': case '-': case '.': case '0': - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': - case '9': case '<': case '>': case 'A': - case 'B': case 'C': case 'D': case 'E': - case 'F': case 'G': case 'H': case 'I': - case 'J': case 'K': case 'L': case 'M': - case 'N': case 'O': case 'P': case 'Q': - case 'R': case 'S': case 'T': case 'U': - case 'V': case 'W': case 'X': case 'Y': - case 'Z': case '_': case 'a': case 'b': - case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': - case 'k': case 'l': case 'm': case 'n': - case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': - case 'w': case 'x': case 'y': case 'z': - { - mWORD(true); - theRetToken=_returnToken; - break; - } - case '(': - { - mLEFT_PAREN(true); - theRetToken=_returnToken; - break; - } - case ')': - { - mRIGHT_PAREN(true); - theRetToken=_returnToken; - break; - } - case '\t': case '\n': case '\r': case ' ': - { - mWHITESPACE(true); - theRetToken=_returnToken; - break; - } - case '=': - { - mOPERATOR(true); - theRetToken=_returnToken; - break; - } - default: - { - if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);} - else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - } - if ( _returnToken==null ) continue tryAgain; // found SKIP token - _ttype = _returnToken.getType(); - _ttype = testLiteralsTable(_ttype); - _returnToken.setType(_ttype); - return _returnToken; - } - catch (RecognitionException e) { - throw new TokenStreamRecognitionException(e); - } - } - catch (CharStreamException cse) { - if ( cse instanceof CharStreamIOException ) { - throw new TokenStreamIOException(((CharStreamIOException)cse).io); - } - else { - throw new TokenStreamException(cse.getMessage()); - } - } - } -} - - public final void mWORD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = WORD; - int _saveIndex; - - { - int _cnt3=0; - _loop3: - do { - switch ( LA(1)) { - case 'a': case 'b': case 'c': case 'd': - case 'e': case 'f': case 'g': case 'h': - case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': - case 'q': case 'r': case 's': case 't': - case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - { - matchRange('a','z'); - break; - } - case 'A': case 'B': case 'C': case 'D': - case 'E': case 'F': case 'G': case 'H': - case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': - case 'Q': case 'R': case 'S': case 'T': - case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - { - matchRange('A','Z'); - break; - } - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': - { - matchRange('0','9'); - break; - } - case '.': - { - match('.'); - break; - } - case '$': - { - match('$'); - break; - } - case '_': - { - match('_'); - break; - } - case '-': - { - match('-'); - break; - } - case '<': - { - match('<'); - break; - } - case '>': - { - match('>'); - break; - } - default: - { - if ( _cnt3>=1 ) { break _loop3; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} - } - } - _cnt3++; - } while (true); - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mLEFT_PAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = LEFT_PAREN; - int _saveIndex; - - match('('); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mRIGHT_PAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = RIGHT_PAREN; - int _saveIndex; - - match(')'); - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mWHITESPACE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = WHITESPACE; - int _saveIndex; - - { - switch ( LA(1)) { - case ' ': - { - match(' '); - break; - } - case '\t': - { - match('\t'); - break; - } - case '\r': - { - match('\r'); - break; - } - case '\n': - { - match('\n'); - break; - } - default: - { - throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); - } - } - } - _ttype = Token.SKIP; - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - public final void mOPERATOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { - int _ttype; Token _token=null; int _begin=text.length(); - _ttype = OPERATOR; - int _saveIndex; - - { - match('='); - } - if ( _createToken && _token==null && _ttype!=Token.SKIP ) { - _token = makeToken(_ttype); - _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); - } - _returnToken = _token; - } - - - - } + +import java.io.InputStream; +import antlr.TokenStreamException; +import antlr.TokenStreamIOException; +import antlr.TokenStreamRecognitionException; +import antlr.CharStreamException; +import antlr.CharStreamIOException; +import antlr.ANTLRException; +import java.io.Reader; +import java.util.Hashtable; +import antlr.CharScanner; +import antlr.InputBuffer; +import antlr.ByteBuffer; +import antlr.CharBuffer; +import antlr.Token; +import antlr.CommonToken; +import antlr.RecognitionException; +import antlr.NoViableAltForCharException; +import antlr.MismatchedCharException; +import antlr.TokenStream; +import antlr.ANTLRHashString; +import antlr.LexerSharedInputState; +import antlr.collections.impl.BitSet; +import antlr.SemanticException; + +public class FilterExpressionLexer extends antlr.CharScanner implements FilterExpressionLexerTokenTypes, TokenStream + { +public FilterExpressionLexer(InputStream in) { + this(new ByteBuffer(in)); +} +public FilterExpressionLexer(Reader in) { + this(new CharBuffer(in)); +} +public FilterExpressionLexer(InputBuffer ib) { + this(new LexerSharedInputState(ib)); +} +public FilterExpressionLexer(LexerSharedInputState state) { + super(state); + caseSensitiveLiterals = true; + setCaseSensitive(true); + literals = new Hashtable(); + literals.put(new ANTLRHashString("or", this), new Integer(9)); + literals.put(new ANTLRHashString("and", this), new Integer(10)); + literals.put(new ANTLRHashString("not", this), new Integer(11)); +} + +public Token nextToken() throws TokenStreamException { + Token theRetToken=null; +tryAgain: + for (;;) { + Token _token = null; + int _ttype = Token.INVALID_TYPE; + resetText(); + try { // for char stream error handling + try { // for lexical error handling + switch ( LA(1)) { + case '$': case '-': case '.': case '0': + case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': + case '9': case ':': case '<': case '>': + case 'A': case 'B': case 'C': case 'D': + case 'E': case 'F': case 'G': case 'H': + case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': + case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': case '_': case 'a': + case 'b': case 'c': case 'd': case 'e': + case 'f': case 'g': case 'h': case 'i': + case 'j': case 'k': case 'l': case 'm': + case 'n': case 'o': case 'p': case 'q': + case 'r': case 's': case 't': case 'u': + case 'v': case 'w': case 'x': case 'y': + case 'z': + { + mWORD(true); + theRetToken=_returnToken; + break; + } + case '(': + { + mLEFT_PAREN(true); + theRetToken=_returnToken; + break; + } + case ')': + { + mRIGHT_PAREN(true); + theRetToken=_returnToken; + break; + } + case '\t': case '\n': case '\r': case ' ': + { + mWHITESPACE(true); + theRetToken=_returnToken; + break; + } + case '=': + { + mOPERATOR(true); + theRetToken=_returnToken; + break; + } + default: + { + if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);} + else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} + } + } + if ( _returnToken==null ) continue tryAgain; // found SKIP token + _ttype = _returnToken.getType(); + _ttype = testLiteralsTable(_ttype); + _returnToken.setType(_ttype); + return _returnToken; + } + catch (RecognitionException e) { + throw new TokenStreamRecognitionException(e); + } + } + catch (CharStreamException cse) { + if ( cse instanceof CharStreamIOException ) { + throw new TokenStreamIOException(((CharStreamIOException)cse).io); + } + else { + throw new TokenStreamException(cse.getMessage()); + } + } + } +} + + public final void mWORD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; Token _token=null; int _begin=text.length(); + _ttype = WORD; + int _saveIndex; + + { + int _cnt3=0; + _loop3: + do { + switch ( LA(1)) { + case 'a': case 'b': case 'c': case 'd': + case 'e': case 'f': case 'g': case 'h': + case 'i': case 'j': case 'k': case 'l': + case 'm': case 'n': case 'o': case 'p': + case 'q': case 'r': case 's': case 't': + case 'u': case 'v': case 'w': case 'x': + case 'y': case 'z': + { + matchRange('a','z'); + break; + } + case 'A': case 'B': case 'C': case 'D': + case 'E': case 'F': case 'G': case 'H': + case 'I': case 'J': case 'K': case 'L': + case 'M': case 'N': case 'O': case 'P': + case 'Q': case 'R': case 'S': case 'T': + case 'U': case 'V': case 'W': case 'X': + case 'Y': case 'Z': + { + matchRange('A','Z'); + break; + } + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + case '8': case '9': + { + matchRange('0','9'); + break; + } + case '.': + { + match('.'); + break; + } + case '$': + { + match('$'); + break; + } + case '_': + { + match('_'); + break; + } + case '-': + { + match('-'); + break; + } + case '<': + { + match('<'); + break; + } + case '>': + { + match('>'); + break; + } + case ':': + { + match(':'); + break; + } + default: + { + if ( _cnt3>=1 ) { break _loop3; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());} + } + } + _cnt3++; + } while (true); + } + if ( _createToken && _token==null && _ttype!=Token.SKIP ) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); + } + _returnToken = _token; + } + + public final void mLEFT_PAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; Token _token=null; int _begin=text.length(); + _ttype = LEFT_PAREN; + int _saveIndex; + + match('('); + if ( _createToken && _token==null && _ttype!=Token.SKIP ) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); + } + _returnToken = _token; + } + + public final void mRIGHT_PAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; Token _token=null; int _begin=text.length(); + _ttype = RIGHT_PAREN; + int _saveIndex; + + match(')'); + if ( _createToken && _token==null && _ttype!=Token.SKIP ) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); + } + _returnToken = _token; + } + + public final void mWHITESPACE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; Token _token=null; int _begin=text.length(); + _ttype = WHITESPACE; + int _saveIndex; + + { + switch ( LA(1)) { + case ' ': + { + match(' '); + break; + } + case '\t': + { + match('\t'); + break; + } + case '\r': + { + match('\r'); + break; + } + case '\n': + { + match('\n'); + break; + } + default: + { + throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn()); + } + } + } + _ttype = Token.SKIP; + if ( _createToken && _token==null && _ttype!=Token.SKIP ) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); + } + _returnToken = _token; + } + + public final void mOPERATOR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException { + int _ttype; Token _token=null; int _begin=text.length(); + _ttype = OPERATOR; + int _saveIndex; + + { + match('='); + } + if ( _createToken && _token==null && _ttype!=Token.SKIP ) { + _token = makeToken(_ttype); + _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin)); + } + _returnToken = _token; + } + + + + } diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexer.smap b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexer.smap index 9878698..258dbbc 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexer.smap +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexer.smap @@ -1,140 +1,143 @@ -SMAP -FilterExpressionLexer.java -G -*S G -*F -+ 0 FilterExpression.g -FilterExpression.g -*L -0:78 -0:84 -0:90 -0:96 -0:102 -1:3 -8:133 -8:134 -8:135 -8:136 -8:139 -8:140 -8:141 -8:142 -8:143 -8:144 -8:145 -8:146 -8:147 -8:148 -8:149 -8:150 -8:151 -8:154 -8:155 -8:156 -8:157 -8:158 -8:159 -8:160 -8:161 -8:162 -8:165 -8:166 -8:167 -8:168 -8:169 -8:172 -8:173 -8:174 -8:177 -8:178 -8:179 -8:182 -8:183 -8:184 -8:187 -8:188 -8:189 -8:192 -8:193 -8:194 -8:197 -8:198 -8:199 -8:202 -8:203 -8:204 -8:205 -8:206 -8:207 -8:208 -8:209 -8:210 -8:211 -8:212 -8:213 -8:214 -8:215 -11:217 -11:218 -11:219 -11:220 -11:222 -11:223 -11:224 -11:225 -11:226 -11:227 -11:228 -12:230 -12:231 -12:232 -12:233 -12:235 -12:236 -12:237 -12:238 -12:239 -12:240 -12:241 -14:243 -14:244 -14:245 -14:246 -14:277 -14:278 -14:279 -14:280 -14:281 -14:282 -15:249 -15:250 -15:251 -15:252 -15:255 -15:256 -15:257 -15:260 -15:261 -15:262 -15:265 -15:266 -15:267 -15:270 -15:271 -15:272 -15:273 -15:274 -15:276 -18:284 -18:285 -18:286 -18:287 -18:290 -18:292 -18:293 -18:294 -18:295 -18:296 -18:297 -*E +SMAP +FilterExpressionLexer.java +G +*S G +*F ++ 0 FilterExpression.g +FilterExpression.g +*L +0:79 +0:85 +0:91 +0:97 +0:103 +1:3 +8:134 +8:135 +8:136 +8:137 +8:140 +8:141 +8:142 +8:143 +8:144 +8:145 +8:146 +8:147 +8:148 +8:149 +8:150 +8:151 +8:152 +8:155 +8:156 +8:157 +8:158 +8:159 +8:160 +8:161 +8:162 +8:163 +8:166 +8:167 +8:168 +8:169 +8:170 +8:173 +8:174 +8:175 +8:178 +8:179 +8:180 +8:183 +8:184 +8:185 +8:188 +8:189 +8:190 +8:193 +8:194 +8:195 +8:198 +8:199 +8:200 +8:203 +8:204 +8:205 +8:208 +8:209 +8:210 +8:211 +8:212 +8:213 +8:214 +8:215 +8:216 +8:217 +8:218 +8:219 +8:220 +8:221 +11:223 +11:224 +11:225 +11:226 +11:228 +11:229 +11:230 +11:231 +11:232 +11:233 +11:234 +12:236 +12:237 +12:238 +12:239 +12:241 +12:242 +12:243 +12:244 +12:245 +12:246 +12:247 +14:249 +14:250 +14:251 +14:252 +14:283 +14:284 +14:285 +14:286 +14:287 +14:288 +15:255 +15:256 +15:257 +15:258 +15:261 +15:262 +15:263 +15:266 +15:267 +15:268 +15:271 +15:272 +15:273 +15:276 +15:277 +15:278 +15:279 +15:280 +15:282 +18:290 +18:291 +18:292 +18:293 +18:296 +18:298 +18:299 +18:300 +18:301 +18:302 +18:303 +*E diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexerTokenTypes.java b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexerTokenTypes.java index f7e212f..d74d5f6 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexerTokenTypes.java +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexerTokenTypes.java @@ -1,16 +1,16 @@ -// $ANTLR 2.7.7 (20060906): "FilterExpression.g" -> "FilterExpressionLexer.java"$ +// $ANTLR 2.7.7 (20060906): "FilterExpression.g" -> "FilterExpressionLexer.java"$ package io.djigger.aggregation.filter; - -public interface FilterExpressionLexerTokenTypes { - int EOF = 1; - int NULL_TREE_LOOKAHEAD = 3; - int WORD = 4; - int LEFT_PAREN = 5; - int RIGHT_PAREN = 6; - int WHITESPACE = 7; - int OPERATOR = 8; - int LITERAL_or = 9; - int LITERAL_and = 10; - int LITERAL_not = 11; -} + +public interface FilterExpressionLexerTokenTypes { + int EOF = 1; + int NULL_TREE_LOOKAHEAD = 3; + int WORD = 4; + int LEFT_PAREN = 5; + int RIGHT_PAREN = 6; + int WHITESPACE = 7; + int OPERATOR = 8; + int LITERAL_or = 9; + int LITERAL_and = 10; + int LITERAL_not = 11; +} diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexerTokenTypes.txt b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexerTokenTypes.txt index 6d15d1d..ec6a1f0 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexerTokenTypes.txt +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionLexerTokenTypes.txt @@ -1,10 +1,10 @@ -// $ANTLR 2.7.7 (20060906): FilterExpression.g -> FilterExpressionLexerTokenTypes.txt$ -FilterExpressionLexer // output token vocab name -WORD=4 -LEFT_PAREN=5 -RIGHT_PAREN=6 -WHITESPACE=7 -OPERATOR=8 -LITERAL_or="or"=9 -LITERAL_and="and"=10 -LITERAL_not="not"=11 +// $ANTLR 2.7.7 (20060906): FilterExpression.g -> FilterExpressionLexerTokenTypes.txt$ +FilterExpressionLexer // output token vocab name +WORD=4 +LEFT_PAREN=5 +RIGHT_PAREN=6 +WHITESPACE=7 +OPERATOR=8 +LITERAL_or="or"=9 +LITERAL_and="and"=10 +LITERAL_not="not"=11 diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionParser.java b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionParser.java index e670143..21aa6bd 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionParser.java +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionParser.java @@ -1,267 +1,267 @@ -// $ANTLR 2.7.7 (20060906): "FilterExpression.g" -> "FilterExpressionParser.java"$ +// $ANTLR 2.7.7 (20060906): "FilterExpression.g" -> "FilterExpressionParser.java"$ package io.djigger.aggregation.filter; - -import antlr.TokenBuffer; -import antlr.TokenStreamException; -import antlr.TokenStreamIOException; -import antlr.ANTLRException; -import antlr.LLkParser; -import antlr.Token; -import antlr.TokenStream; -import antlr.RecognitionException; -import antlr.NoViableAltException; -import antlr.MismatchedTokenException; -import antlr.SemanticException; -import antlr.ParserSharedInputState; -import antlr.collections.impl.BitSet; -import antlr.collections.AST; -import java.util.Hashtable; -import antlr.ASTFactory; -import antlr.ASTPair; -import antlr.collections.impl.ASTArray; - -public class FilterExpressionParser extends antlr.LLkParser implements FilterExpressionLexerTokenTypes - { - -protected FilterExpressionParser(TokenBuffer tokenBuf, int k) { - super(tokenBuf,k); - tokenNames = _tokenNames; - buildTokenTypeASTClassMap(); - astFactory = new ASTFactory(getTokenTypeToASTClassMap()); -} - -public FilterExpressionParser(TokenBuffer tokenBuf) { - this(tokenBuf,1); -} - -protected FilterExpressionParser(TokenStream lexer, int k) { - super(lexer,k); - tokenNames = _tokenNames; - buildTokenTypeASTClassMap(); - astFactory = new ASTFactory(getTokenTypeToASTClassMap()); -} - -public FilterExpressionParser(TokenStream lexer) { - this(lexer,1); -} - -public FilterExpressionParser(ParserSharedInputState state) { - super(state,1); - tokenNames = _tokenNames; - buildTokenTypeASTClassMap(); - astFactory = new ASTFactory(getTokenTypeToASTClassMap()); -} - - public final void orexpression() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - AST orexpression_AST = null; - - try { // for error handling - andexpression(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop12: - do { - if ((LA(1)==LITERAL_or)) { - AST tmp4_AST = null; - tmp4_AST = astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp4_AST); - match(LITERAL_or); - andexpression(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop12; - } - - } while (true); - } - orexpression_AST = (AST)currentAST.root; - } - catch (RecognitionException ex) { - reportError(ex); - recover(ex,_tokenSet_0); - } - returnAST = orexpression_AST; - } - - public final void andexpression() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - AST andexpression_AST = null; - - try { // for error handling - notexpression(); - astFactory.addASTChild(currentAST, returnAST); - { - _loop15: - do { - if ((LA(1)==LITERAL_and)) { - AST tmp5_AST = null; - tmp5_AST = astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp5_AST); - match(LITERAL_and); - notexpression(); - astFactory.addASTChild(currentAST, returnAST); - } - else { - break _loop15; - } - - } while (true); - } - andexpression_AST = (AST)currentAST.root; - } - catch (RecognitionException ex) { - reportError(ex); - recover(ex,_tokenSet_1); - } - returnAST = andexpression_AST; - } - - public final void notexpression() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - AST notexpression_AST = null; - - try { // for error handling - { - switch ( LA(1)) { - case LITERAL_not: - { - AST tmp6_AST = null; - tmp6_AST = astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp6_AST); - match(LITERAL_not); - break; - } - case WORD: - case LEFT_PAREN: - { - break; - } - default: - { - throw new NoViableAltException(LT(1), getFilename()); - } - } - } - atom(); - astFactory.addASTChild(currentAST, returnAST); - notexpression_AST = (AST)currentAST.root; - } - catch (RecognitionException ex) { - reportError(ex); - recover(ex,_tokenSet_2); - } - returnAST = notexpression_AST; - } - - public final void atom() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - AST atom_AST = null; - - try { // for error handling - if ((LA(1)==WORD)) { - AST tmp7_AST = null; - tmp7_AST = astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp7_AST); - match(WORD); - atom_AST = (AST)currentAST.root; - } - else if ((LA(1)==WORD)) { - comparisonexpression(); - astFactory.addASTChild(currentAST, returnAST); - atom_AST = (AST)currentAST.root; - } - else if ((LA(1)==LEFT_PAREN)) { - match(LEFT_PAREN); - orexpression(); - astFactory.addASTChild(currentAST, returnAST); - match(RIGHT_PAREN); - atom_AST = (AST)currentAST.root; - } - else { - throw new NoViableAltException(LT(1), getFilename()); - } - - } - catch (RecognitionException ex) { - reportError(ex); - recover(ex,_tokenSet_2); - } - returnAST = atom_AST; - } - - public final void comparisonexpression() throws RecognitionException, TokenStreamException { - - returnAST = null; - ASTPair currentAST = new ASTPair(); - AST comparisonexpression_AST = null; - - try { // for error handling - AST tmp10_AST = null; - tmp10_AST = astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp10_AST); - match(WORD); - AST tmp11_AST = null; - tmp11_AST = astFactory.create(LT(1)); - astFactory.makeASTRoot(currentAST, tmp11_AST); - match(OPERATOR); - AST tmp12_AST = null; - tmp12_AST = astFactory.create(LT(1)); - astFactory.addASTChild(currentAST, tmp12_AST); - match(WORD); - comparisonexpression_AST = (AST)currentAST.root; - } - catch (RecognitionException ex) { - reportError(ex); - recover(ex,_tokenSet_2); - } - returnAST = comparisonexpression_AST; - } - - - public static final String[] _tokenNames = { - "<0>", - "EOF", - "<2>", - "NULL_TREE_LOOKAHEAD", - "WORD", - "LEFT_PAREN", - "RIGHT_PAREN", - "WHITESPACE", - "OPERATOR", - "\"or\"", - "\"and\"", - "\"not\"" - }; - - protected void buildTokenTypeASTClassMap() { - tokenTypeToASTClassMap=null; - }; - - private static final long[] mk_tokenSet_0() { - long[] data = { 64L, 0L}; - return data; - } - public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); - private static final long[] mk_tokenSet_1() { - long[] data = { 576L, 0L}; - return data; - } - public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); - private static final long[] mk_tokenSet_2() { - long[] data = { 1600L, 0L}; - return data; - } - public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); - - } + +import antlr.TokenBuffer; +import antlr.TokenStreamException; +import antlr.TokenStreamIOException; +import antlr.ANTLRException; +import antlr.LLkParser; +import antlr.Token; +import antlr.TokenStream; +import antlr.RecognitionException; +import antlr.NoViableAltException; +import antlr.MismatchedTokenException; +import antlr.SemanticException; +import antlr.ParserSharedInputState; +import antlr.collections.impl.BitSet; +import antlr.collections.AST; +import java.util.Hashtable; +import antlr.ASTFactory; +import antlr.ASTPair; +import antlr.collections.impl.ASTArray; + +public class FilterExpressionParser extends antlr.LLkParser implements FilterExpressionLexerTokenTypes + { + +protected FilterExpressionParser(TokenBuffer tokenBuf, int k) { + super(tokenBuf,k); + tokenNames = _tokenNames; + buildTokenTypeASTClassMap(); + astFactory = new ASTFactory(getTokenTypeToASTClassMap()); +} + +public FilterExpressionParser(TokenBuffer tokenBuf) { + this(tokenBuf,1); +} + +protected FilterExpressionParser(TokenStream lexer, int k) { + super(lexer,k); + tokenNames = _tokenNames; + buildTokenTypeASTClassMap(); + astFactory = new ASTFactory(getTokenTypeToASTClassMap()); +} + +public FilterExpressionParser(TokenStream lexer) { + this(lexer,1); +} + +public FilterExpressionParser(ParserSharedInputState state) { + super(state,1); + tokenNames = _tokenNames; + buildTokenTypeASTClassMap(); + astFactory = new ASTFactory(getTokenTypeToASTClassMap()); +} + + public final void orexpression() throws RecognitionException, TokenStreamException { + + returnAST = null; + ASTPair currentAST = new ASTPair(); + AST orexpression_AST = null; + + try { // for error handling + andexpression(); + astFactory.addASTChild(currentAST, returnAST); + { + _loop12: + do { + if ((LA(1)==LITERAL_or)) { + AST tmp4_AST = null; + tmp4_AST = astFactory.create(LT(1)); + astFactory.makeASTRoot(currentAST, tmp4_AST); + match(LITERAL_or); + andexpression(); + astFactory.addASTChild(currentAST, returnAST); + } + else { + break _loop12; + } + + } while (true); + } + orexpression_AST = (AST)currentAST.root; + } + catch (RecognitionException ex) { + reportError(ex); + recover(ex,_tokenSet_0); + } + returnAST = orexpression_AST; + } + + public final void andexpression() throws RecognitionException, TokenStreamException { + + returnAST = null; + ASTPair currentAST = new ASTPair(); + AST andexpression_AST = null; + + try { // for error handling + notexpression(); + astFactory.addASTChild(currentAST, returnAST); + { + _loop15: + do { + if ((LA(1)==LITERAL_and)) { + AST tmp5_AST = null; + tmp5_AST = astFactory.create(LT(1)); + astFactory.makeASTRoot(currentAST, tmp5_AST); + match(LITERAL_and); + notexpression(); + astFactory.addASTChild(currentAST, returnAST); + } + else { + break _loop15; + } + + } while (true); + } + andexpression_AST = (AST)currentAST.root; + } + catch (RecognitionException ex) { + reportError(ex); + recover(ex,_tokenSet_1); + } + returnAST = andexpression_AST; + } + + public final void notexpression() throws RecognitionException, TokenStreamException { + + returnAST = null; + ASTPair currentAST = new ASTPair(); + AST notexpression_AST = null; + + try { // for error handling + { + switch ( LA(1)) { + case LITERAL_not: + { + AST tmp6_AST = null; + tmp6_AST = astFactory.create(LT(1)); + astFactory.makeASTRoot(currentAST, tmp6_AST); + match(LITERAL_not); + break; + } + case WORD: + case LEFT_PAREN: + { + break; + } + default: + { + throw new NoViableAltException(LT(1), getFilename()); + } + } + } + atom(); + astFactory.addASTChild(currentAST, returnAST); + notexpression_AST = (AST)currentAST.root; + } + catch (RecognitionException ex) { + reportError(ex); + recover(ex,_tokenSet_2); + } + returnAST = notexpression_AST; + } + + public final void atom() throws RecognitionException, TokenStreamException { + + returnAST = null; + ASTPair currentAST = new ASTPair(); + AST atom_AST = null; + + try { // for error handling + if ((LA(1)==WORD)) { + AST tmp7_AST = null; + tmp7_AST = astFactory.create(LT(1)); + astFactory.addASTChild(currentAST, tmp7_AST); + match(WORD); + atom_AST = (AST)currentAST.root; + } + else if ((LA(1)==WORD)) { + comparisonexpression(); + astFactory.addASTChild(currentAST, returnAST); + atom_AST = (AST)currentAST.root; + } + else if ((LA(1)==LEFT_PAREN)) { + match(LEFT_PAREN); + orexpression(); + astFactory.addASTChild(currentAST, returnAST); + match(RIGHT_PAREN); + atom_AST = (AST)currentAST.root; + } + else { + throw new NoViableAltException(LT(1), getFilename()); + } + + } + catch (RecognitionException ex) { + reportError(ex); + recover(ex,_tokenSet_2); + } + returnAST = atom_AST; + } + + public final void comparisonexpression() throws RecognitionException, TokenStreamException { + + returnAST = null; + ASTPair currentAST = new ASTPair(); + AST comparisonexpression_AST = null; + + try { // for error handling + AST tmp10_AST = null; + tmp10_AST = astFactory.create(LT(1)); + astFactory.addASTChild(currentAST, tmp10_AST); + match(WORD); + AST tmp11_AST = null; + tmp11_AST = astFactory.create(LT(1)); + astFactory.makeASTRoot(currentAST, tmp11_AST); + match(OPERATOR); + AST tmp12_AST = null; + tmp12_AST = astFactory.create(LT(1)); + astFactory.addASTChild(currentAST, tmp12_AST); + match(WORD); + comparisonexpression_AST = (AST)currentAST.root; + } + catch (RecognitionException ex) { + reportError(ex); + recover(ex,_tokenSet_2); + } + returnAST = comparisonexpression_AST; + } + + + public static final String[] _tokenNames = { + "<0>", + "EOF", + "<2>", + "NULL_TREE_LOOKAHEAD", + "WORD", + "LEFT_PAREN", + "RIGHT_PAREN", + "WHITESPACE", + "OPERATOR", + "\"or\"", + "\"and\"", + "\"not\"" + }; + + protected void buildTokenTypeASTClassMap() { + tokenTypeToASTClassMap=null; + }; + + private static final long[] mk_tokenSet_0() { + long[] data = { 64L, 0L}; + return data; + } + public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0()); + private static final long[] mk_tokenSet_1() { + long[] data = { 576L, 0L}; + return data; + } + public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1()); + private static final long[] mk_tokenSet_2() { + long[] data = { 1600L, 0L}; + return data; + } + public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2()); + + } diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionParser.smap b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionParser.smap index 7279fc8..4714561 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionParser.smap +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionParser.smap @@ -1,158 +1,158 @@ -SMAP -FilterExpressionParser.java -G -*S G -*F -+ 0 FilterExpression.g -FilterExpression.g -*L -1:3 -26:56 -26:58 -26:59 -26:60 -26:62 -26:83 -26:84 -26:85 -26:86 -26:87 -26:88 -26:89 -27:63 -27:64 -27:65 -27:66 -27:67 -27:68 -27:69 -27:70 -27:71 -27:72 -27:73 -27:74 -27:75 -27:76 -27:77 -27:78 -27:80 -27:81 -27:82 -30:91 -30:93 -30:94 -30:95 -30:97 -30:118 -30:119 -30:120 -30:121 -30:122 -30:123 -30:124 -31:98 -31:99 -31:100 -31:101 -31:102 -31:103 -31:104 -31:105 -31:106 -31:107 -31:108 -31:109 -31:110 -31:111 -31:112 -31:113 -31:115 -31:116 -31:117 -34:126 -34:128 -34:129 -34:130 -34:132 -34:157 -34:158 -34:159 -34:160 -34:161 -34:162 -34:163 -35:134 -35:135 -35:136 -35:137 -35:138 -35:139 -35:140 -35:148 -35:149 -35:150 -35:151 -35:152 -35:154 -35:155 -35:156 -38:203 -38:205 -38:206 -38:207 -38:209 -38:223 -38:224 -38:225 -38:226 -38:227 -38:228 -38:229 -39:210 -39:211 -39:212 -39:213 -39:214 -39:215 -39:216 -39:217 -39:218 -39:219 -39:220 -39:221 -41:222 -42:165 -42:167 -42:168 -42:169 -42:171 -42:178 -42:183 -42:190 -42:191 -42:192 -42:193 -42:195 -42:196 -42:197 -42:198 -42:199 -42:200 -42:201 -43:172 -43:173 -43:174 -43:175 -43:176 -44:179 -44:180 -44:181 -44:182 -45:177 -45:184 -45:185 -45:186 -45:187 -45:188 -47:189 -*E +SMAP +FilterExpressionParser.java +G +*S G +*F ++ 0 FilterExpression.g +FilterExpression.g +*L +1:3 +26:56 +26:58 +26:59 +26:60 +26:62 +26:83 +26:84 +26:85 +26:86 +26:87 +26:88 +26:89 +27:63 +27:64 +27:65 +27:66 +27:67 +27:68 +27:69 +27:70 +27:71 +27:72 +27:73 +27:74 +27:75 +27:76 +27:77 +27:78 +27:80 +27:81 +27:82 +30:91 +30:93 +30:94 +30:95 +30:97 +30:118 +30:119 +30:120 +30:121 +30:122 +30:123 +30:124 +31:98 +31:99 +31:100 +31:101 +31:102 +31:103 +31:104 +31:105 +31:106 +31:107 +31:108 +31:109 +31:110 +31:111 +31:112 +31:113 +31:115 +31:116 +31:117 +34:126 +34:128 +34:129 +34:130 +34:132 +34:157 +34:158 +34:159 +34:160 +34:161 +34:162 +34:163 +35:134 +35:135 +35:136 +35:137 +35:138 +35:139 +35:140 +35:148 +35:149 +35:150 +35:151 +35:152 +35:154 +35:155 +35:156 +38:203 +38:205 +38:206 +38:207 +38:209 +38:223 +38:224 +38:225 +38:226 +38:227 +38:228 +38:229 +39:210 +39:211 +39:212 +39:213 +39:214 +39:215 +39:216 +39:217 +39:218 +39:219 +39:220 +39:221 +41:222 +42:165 +42:167 +42:168 +42:169 +42:171 +42:178 +42:183 +42:190 +42:191 +42:192 +42:193 +42:195 +42:196 +42:197 +42:198 +42:199 +42:200 +42:201 +43:172 +43:173 +43:174 +43:175 +43:176 +44:179 +44:180 +44:181 +44:182 +45:177 +45:184 +45:185 +45:186 +45:187 +45:188 +47:189 +*E diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionTreeParser.java b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionTreeParser.java index 2f20c89..551a968 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionTreeParser.java +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionTreeParser.java @@ -1,22 +1,22 @@ -// $ANTLR 2.7.7 (20060906): "FilterExpression.g" -> "FilterExpressionTreeParser.java"$ +// $ANTLR 2.7.7 (20060906): "FilterExpression.g" -> "FilterExpressionTreeParser.java"$ package io.djigger.aggregation.filter; - -import antlr.TreeParser; -import antlr.Token; -import antlr.collections.AST; -import antlr.RecognitionException; -import antlr.ANTLRException; -import antlr.NoViableAltException; -import antlr.MismatchedTokenException; -import antlr.SemanticException; -import antlr.collections.impl.BitSet; -import antlr.ASTPair; -import antlr.collections.impl.ASTArray; - - -public class FilterExpressionTreeParser extends antlr.TreeParser implements FilterExpressionLexerTokenTypes - { + +import antlr.TreeParser; +import antlr.Token; +import antlr.collections.AST; +import antlr.RecognitionException; +import antlr.ANTLRException; +import antlr.NoViableAltException; +import antlr.MismatchedTokenException; +import antlr.SemanticException; +import antlr.collections.impl.BitSet; +import antlr.ASTPair; +import antlr.collections.impl.ASTArray; + + +public class FilterExpressionTreeParser extends antlr.TreeParser implements FilterExpressionLexerTokenTypes + { private AtomicFilterFactory factory; @@ -24,111 +24,111 @@ public void setFilterFactory(AtomicFilterFactory factory) { this.factory = factory; } -public FilterExpressionTreeParser() { - tokenNames = _tokenNames; -} - - public final Filter cond(AST _t) throws RecognitionException { - Filter r; - - AST cond_AST_in = (_t == ASTNULL) ? null : (AST)_t; - AST c = null; - - Filter a, b; - r = null; - - - try { // for error handling - if (_t==null) _t=ASTNULL; - switch ( _t.getType()) { - case LITERAL_and: - { - AST __t21 = _t; - AST tmp1_AST_in = (AST)_t; - match(_t,LITERAL_and); - _t = _t.getFirstChild(); - a=cond(_t); - _t = _retTree; - b=cond(_t); - _t = _retTree; - _t = __t21; - _t = _t.getNextSibling(); - - r = new AndExpression(a, b); - - break; - } - case LITERAL_or: - { - AST __t22 = _t; - AST tmp2_AST_in = (AST)_t; - match(_t,LITERAL_or); - _t = _t.getFirstChild(); - a=cond(_t); - _t = _retTree; - b=cond(_t); - _t = _retTree; - _t = __t22; - _t = _t.getNextSibling(); - - r = new OrExpression(a, b); - - break; - } - case LITERAL_not: - { - AST __t23 = _t; - AST tmp3_AST_in = (AST)_t; - match(_t,LITERAL_not); - _t = _t.getFirstChild(); - a=cond(_t); - _t = _retTree; - _t = __t23; - _t = _t.getNextSibling(); - - r = new NotExpression(a); - - break; - } - case WORD: - { - c = (AST)_t; - match(_t,WORD); - _t = _t.getNextSibling(); - - r = factory.createFilter(c.getText()); - - break; - } - default: - { - throw new NoViableAltException(_t); - } - } - } - catch (RecognitionException ex) { - reportError(ex); - if (_t!=null) {_t = _t.getNextSibling();} - } - _retTree = _t; - return r; - } - - - public static final String[] _tokenNames = { - "<0>", - "EOF", - "<2>", - "NULL_TREE_LOOKAHEAD", - "WORD", - "LEFT_PAREN", - "RIGHT_PAREN", - "WHITESPACE", - "OPERATOR", - "\"or\"", - "\"and\"", - "\"not\"" - }; - - } - +public FilterExpressionTreeParser() { + tokenNames = _tokenNames; +} + + public final Filter cond(AST _t) throws RecognitionException { + Filter r; + + AST cond_AST_in = (_t == ASTNULL) ? null : (AST)_t; + AST c = null; + + Filter a, b; + r = null; + + + try { // for error handling + if (_t==null) _t=ASTNULL; + switch ( _t.getType()) { + case LITERAL_and: + { + AST __t21 = _t; + AST tmp1_AST_in = (AST)_t; + match(_t,LITERAL_and); + _t = _t.getFirstChild(); + a=cond(_t); + _t = _retTree; + b=cond(_t); + _t = _retTree; + _t = __t21; + _t = _t.getNextSibling(); + + r = new AndExpression(a, b); + + break; + } + case LITERAL_or: + { + AST __t22 = _t; + AST tmp2_AST_in = (AST)_t; + match(_t,LITERAL_or); + _t = _t.getFirstChild(); + a=cond(_t); + _t = _retTree; + b=cond(_t); + _t = _retTree; + _t = __t22; + _t = _t.getNextSibling(); + + r = new OrExpression(a, b); + + break; + } + case LITERAL_not: + { + AST __t23 = _t; + AST tmp3_AST_in = (AST)_t; + match(_t,LITERAL_not); + _t = _t.getFirstChild(); + a=cond(_t); + _t = _retTree; + _t = __t23; + _t = _t.getNextSibling(); + + r = new NotExpression(a); + + break; + } + case WORD: + { + c = (AST)_t; + match(_t,WORD); + _t = _t.getNextSibling(); + + r = factory.createFilter(c.getText()); + + break; + } + default: + { + throw new NoViableAltException(_t); + } + } + } + catch (RecognitionException ex) { + reportError(ex); + if (_t!=null) {_t = _t.getNextSibling();} + } + _retTree = _t; + return r; + } + + + public static final String[] _tokenNames = { + "<0>", + "EOF", + "<2>", + "NULL_TREE_LOOKAHEAD", + "WORD", + "LEFT_PAREN", + "RIGHT_PAREN", + "WHITESPACE", + "OPERATOR", + "\"or\"", + "\"and\"", + "\"not\"" + }; + + } + diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionTreeParser.smap b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionTreeParser.smap index fb13f9d..e6fdc2e 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionTreeParser.smap +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/FilterExpressionTreeParser.smap @@ -1,79 +1,79 @@ -SMAP -FilterExpressionTreeParser.java -G -*S G -*F -+ 0 FilterExpression.g -FilterExpression.g -*L -1:3 -51:21 -53:23 -54:24 -55:25 -56:26 -59:31 -59:32 -59:41 -59:42 -59:43 -59:103 -59:104 -59:105 -59:106 -59:107 -59:108 -59:109 -59:110 -59:111 -59:112 -59:113 -59:114 -59:115 -60:37 -61:38 -64:44 -64:45 -64:46 -64:47 -64:48 -64:49 -64:50 -64:51 -64:52 -64:53 -64:54 -64:55 -65:57 -67:61 -67:62 -67:63 -67:64 -67:65 -67:66 -67:67 -67:68 -67:69 -67:70 -67:71 -67:72 -68:74 -70:78 -70:79 -70:80 -70:81 -70:82 -70:83 -70:84 -70:85 -70:86 -70:87 -71:89 -76:35 -76:93 -76:94 -76:95 -76:96 -76:97 -77:99 -*E +SMAP +FilterExpressionTreeParser.java +G +*S G +*F ++ 0 FilterExpression.g +FilterExpression.g +*L +1:3 +51:21 +53:23 +54:24 +55:25 +56:26 +59:31 +59:32 +59:41 +59:42 +59:43 +59:103 +59:104 +59:105 +59:106 +59:107 +59:108 +59:109 +59:110 +59:111 +59:112 +59:113 +59:114 +59:115 +60:37 +61:38 +64:44 +64:45 +64:46 +64:47 +64:48 +64:49 +64:50 +64:51 +64:52 +64:53 +64:54 +64:55 +65:57 +67:61 +67:62 +67:63 +67:64 +67:65 +67:66 +67:67 +67:68 +67:69 +67:70 +67:71 +67:72 +68:74 +70:78 +70:79 +70:80 +70:81 +70:82 +70:83 +70:84 +70:85 +70:86 +70:87 +71:89 +76:35 +76:93 +76:94 +76:95 +76:96 +76:97 +77:99 +*E diff --git a/client-ui/src/main/java/io/djigger/aggregation/filter/NodeFilter.java b/client-ui/src/main/java/io/djigger/aggregation/filter/NodeFilter.java index e12f7ab..ee2f99c 100644 --- a/client-ui/src/main/java/io/djigger/aggregation/filter/NodeFilter.java +++ b/client-ui/src/main/java/io/djigger/aggregation/filter/NodeFilter.java @@ -24,25 +24,59 @@ -public class NodeFilter implements Filter { +public class NodeFilter implements Filter, ContextAwareFilter{ private final String excludePattern; private final NodePresentationHelper presentationHelper; + + private static final String ENTRY_PREFIX = "entry:"; + private boolean isEntry = false; + private boolean entryMatched=false; + public NodeFilter(String excludePattern, NodePresentationHelper presentationHelper) { + if(excludePattern.startsWith(ENTRY_PREFIX)) { + excludePattern = excludePattern.substring(ENTRY_PREFIX.length()); + isEntry = true; + } + this.excludePattern = excludePattern; this.presentationHelper = presentationHelper; } @Override public boolean isValid(NodeID nodeID) { - if(presentationHelper.getFullname(nodeID).contains(excludePattern)) { - return true; + if(!isEntry) { + if(presentationHelper.getFullname(nodeID).contains(excludePattern)) { + return true; + } else { + return false; + } } else { - return false; + if(entryMatched) { + return true; + } else { + if(presentationHelper.getFullname(nodeID).contains(excludePattern)) { + entryMatched = true; + return true; + } else { + return false; + } + } } } + @Override + public void startIteration() { + entryMatched = false; + } + + @Override + public void stopIteration() { + // TODO Auto-generated method stub + + } + }