Sha256: f19a3eef9a4958244e0d1b4b66ec0d3645d8f1c30ebb542ac286c5a6c9ffad56

Contents?: true

Size: 1.29 KB

Versions: 24

Compression:

Stored size: 1.29 KB

Contents

module Neo4j
  module Core
    module Traversal

      # Implements the Neo4j Evaluator Java interface, only used internally.
      # @private
      class Evaluator
        include Java::OrgNeo4jGraphdbTraversal::Evaluator

        def initialize(&eval_block)
          @eval_block = eval_block
        end

        # Implements the Java Interface:
        #  evaluate(Path path)
        #  Evaluates a Path and returns an Evaluation containing information about whether or not to include it in the traversal result, i.e return it from the Traverser.
        def evaluate(path)
          ret = @eval_block.call(path)
          case ret
            when :exclude_and_continue then
              Java::OrgNeo4jGraphdbTraversal::Evaluation::EXCLUDE_AND_CONTINUE
            when :exclude_and_prune then
              Java::OrgNeo4jGraphdbTraversal::Evaluation::EXCLUDE_AND_PRUNE
            when :include_and_continue then
              Java::OrgNeo4jGraphdbTraversal::Evaluation::INCLUDE_AND_CONTINUE
            when :include_and_prune then
              Java::OrgNeo4jGraphdbTraversal::Evaluation::INCLUDE_AND_PRUNE
            else
              raise "Got #{ret}, only accept :exclude_and_continue,:exclude_and_prune,:include_and_continue and :include_and_prune"
          end
        end
      end

    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
neo4j-core-0.0.3-java lib/neo4j-core/traversal/evaluator.rb
neo4j-core-0.0.2-java lib/neo4j-core/traversal/evaluator.rb
neo4j-core-0.0.1-java lib/neo4j-core/traversal/evaluator.rb
neo4j-core-2.0.0.alpha.1-java lib/neo4j-core/traversal/evaluator.rb