Package org.infinispan.objectfilter.impl.predicateindex

Examples of org.infinispan.objectfilter.impl.predicateindex.FilterEvalContext


         if (node instanceof PredicateNode) {
            final PredicateNode<AttributeId> predicateNode = (PredicateNode<AttributeId>) node;
            Predicate.Callback predicateCallback = new Predicate.Callback() {
               @Override
               public void handleValue(MatcherEvalContext<?> ctx, boolean isMatching) {
                  FilterEvalContext context = ctx.getFilterContext(filterSubscriptionImpl);
                  predicateNode.handleChildValue(predicateNode, isMatching, context);
               }
            };
            predicateIndex.addSubscriptionForPredicate(predicateNode, predicateCallback);
         }
View Full Code Here


         if (node instanceof PredicateNode) {
            final PredicateNode<AttributeId> predicateNode = (PredicateNode<AttributeId>) node;
            Predicate.Callback predicateCallback = new Predicate.Callback() {
               @Override
               public void handleValue(MatcherEvalContext<?> ctx, boolean isMatching) {
                  FilterEvalContext context = ctx.getFilterContext(filterSubscription);
                  predicateNode.handleChildValue(predicateNode, isMatching, context);
               }
            };
            predicateNode.subscribe(predicateIndex, predicateCallback);
         }
View Full Code Here

      // try to match
      ctx.process(predicateIndex.getRoot());

      // notify subscribers
      for (FilterSubscriptionImpl s : filterSubscriptions) {
         FilterEvalContext filterEvalContext = ctx.getFilterEvalContext(s);
         if (filterEvalContext.getMatchResult()) {
            s.getCallback().onFilterResult(ctx.getInstance(), filterEvalContext.getProjection(), filterEvalContext.getSortProjection());
         }
      }
   }
View Full Code Here

         throw new IllegalArgumentException("argument cannot be null");
      }

      MatcherEvalContext<TypeMetadata, AttributeMetadata, AttributeId> matcherEvalContext = matcher.startContext(instance, filterSubscription);
      if (matcherEvalContext != null) {
         FilterEvalContext filterEvalContext = matcherEvalContext.initSingleFilterContext(filterSubscription);
         matcherEvalContext.process(root);

         if (filterEvalContext.getMatchResult()) {
            return new FilterResultImpl(instance, filterEvalContext.getProjection(), filterEvalContext.getSortProjection());
         }
      }

      return null;
   }
View Full Code Here

      // try to match
      ctx.process(predicateIndex.getRoot());

      // notify subscribers
      for (FilterSubscriptionImpl s : filterSubscriptions) {
         FilterEvalContext filterEvalContext = ctx.getFilterEvalContext(s);
         if (filterEvalContext.getMatchResult()) {
            s.getCallback().onFilterResult(ctx.getInstance(), filterEvalContext.getProjection(), filterEvalContext.getSortProjection());
         }
      }
   }
View Full Code Here

         if (node instanceof PredicateNode) {
            final PredicateNode<AttributeId> predicateNode = (PredicateNode<AttributeId>) node;
            Predicate.Callback predicateCallback = new Predicate.Callback() {
               @Override
               public void handleValue(MatcherEvalContext<?> ctx, boolean isMatching) {
                  FilterEvalContext filterEvalContext = ctx.getFilterEvalContext(filterSubscription);
                  predicateNode.handleChildValue(null, isMatching, filterEvalContext);
               }
            };
            predicateNode.subscribe(predicateIndex, predicateCallback);
         }
View Full Code Here

         if (node instanceof PredicateNode) {
            final PredicateNode<AttributeId> predicateNode = (PredicateNode<AttributeId>) node;
            Predicate.Callback predicateCallback = new Predicate.Callback() {
               @Override
               public void handleValue(MatcherEvalContext<?> ctx, boolean isMatching) {
                  FilterEvalContext filterEvalContext = ctx.getFilterEvalContext(filterSubscriptionImpl);
                  predicateNode.handleChildValue(null, isMatching, filterEvalContext);
               }
            };
            predicateIndex.addSubscriptionForPredicate(predicateNode, predicateCallback);
         }
      }

      return new ObjectFilter() {

         @Override
         public String getEntityTypeName() {
            return filterSubscriptionImpl.getEntityTypeName();
         }

         @Override
         public String[] getProjection() {
            return filterSubscriptionImpl.getProjection();
         }

         @Override
         public SortField[] getSortFields() {
            return filterSubscriptionImpl.getSortFields();
         }

         @Override
         public Comparator<Comparable[]> getComparator() {
            return filterSubscriptionImpl.getComparator();
         }

         @Override
         public FilterResult filter(Object instance) {
            if (instance == null) {
               throw new IllegalArgumentException("argument cannot be null");
            }

            MatcherEvalContext<AttributeId> matcherEvalContext = startContext(instance, knownTypes);
            if (matcherEvalContext != null) {
               FilterEvalContext filterEvalContext = matcherEvalContext.getFilterEvalContext(filterSubscriptionImpl);
               matcherEvalContext.process(predicateIndex.getRoot());

               if (filterEvalContext.getMatchResult()) {
                  return new FilterResultImpl(instance, filterEvalContext.getProjection(), filterEvalContext.getSortProjection());
               }
            }

            return null;
         }
View Full Code Here

TOP

Related Classes of org.infinispan.objectfilter.impl.predicateindex.FilterEvalContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.