Skip to content

Commit

Permalink
Implementing PoC for [Server/Client] Entry / Exit point definition for
Browse files Browse the repository at this point in the history
methods (low prio) #14
  • Loading branch information
jeromecomte committed Apr 17, 2016
1 parent f5c1207 commit 2779827
Show file tree
Hide file tree
Showing 14 changed files with 1,175 additions and 1,096 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -42,6 +43,9 @@ public List<RealNode> transformPath(RealNode realTree, RealNodePath path) {
List<RealNode> 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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -42,6 +43,9 @@ public List<RealNode> transformPath(RealNode realTree, RealNodePath path) {
List<RealNode> 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)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package io.djigger.aggregation.filter;


public class AndExpression<T> implements Filter<T> {
public class AndExpression<T> implements Filter<T>, ContextAwareFilter {

private final Filter<T> filter1;

Expand All @@ -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();
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.djigger.aggregation.filter;

public interface ContextAwareFilter {

public void startIteration();

public void stopIteration();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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: '(';
Expand Down
Loading

0 comments on commit 2779827

Please sign in to comment.