Sha256: cb232cd5cdd4f263f6edca02c40a727bf066b314049d162a838de98f1a0410b2

Contents?: true

Size: 886 Bytes

Versions: 4

Compression:

Stored size: 886 Bytes

Contents

module Neo4j
  module Core
    module Traversal
      # Implements the Neo4j Predicate Java interface, only used internally.
      # @private
      class FilterPredicate
        include Java::OrgNeo4jGraphdbTraversal::Evaluator

        def initialize
          @procs = []
        end

        def add(proc)
          @procs << proc
        end

        def evaluate(path)
          if path.length == 0
            return Java::OrgNeo4jGraphdbTraversal::Evaluation::EXCLUDE_AND_CONTINUE
          end
          # find the first filter which returns false
          # if not found then we will accept this path
          if @procs.find { |p| !p.call(path) }.nil?
            Java::OrgNeo4jGraphdbTraversal::Evaluation::INCLUDE_AND_CONTINUE
          else
            Java::OrgNeo4jGraphdbTraversal::Evaluation::EXCLUDE_AND_CONTINUE
          end

        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
neo4j-core-2.2.1-java lib/neo4j-core/traversal/filter_predicate.rb
neo4j-core-2.2.0-java lib/neo4j-core/traversal/filter_predicate.rb
neo4j-core-2.2.0.rc1-java lib/neo4j-core/traversal/filter_predicate.rb
neo4j-core-2.1.0-java lib/neo4j-core/traversal/filter_predicate.rb