Class: Neo4j::Algo::CostEvaluator

Inherits:
Object
  • Object
show all
Includes:
Core::ToJava
Defined in:
lib/neo4j/algo.rb

Overview

:nodoc

Instance Method Summary collapse

Methods included from Core::ToJava

dir_from_java, dir_to_java, type_to_java, types_to_java

Constructor Details

#initialize(&evaluator) ⇒ CostEvaluator

Returns a new instance of CostEvaluator.



40
41
42
# File 'lib/neo4j/algo.rb', line 40

def initialize(&evaluator)
  @evaluator = evaluator
end

Instance Method Details

#get_cost(relationship, direction) ⇒ Object

Implements the Java Method: T getCost(Relationship relationship, Direction direction) From the JavaDoc: <pre> This is the general method for looking up costs for relationships. This can do anything, like looking up a property or running some small calculation. Parameters: relationship - direction - The direction in which the relationship is being evaluated, either Direction.INCOMING or Direction.OUTGOING. Returns: The cost for this edge/relationship </pre>



54
55
56
# File 'lib/neo4j/algo.rb', line 54

def get_cost(relationship, direction)
  @evaluator.call(relationship, dir_from_java(direction))
end