Class: Neo4j::Algo::CostEvaluator

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

Overview

:nodoc

Instance Method Summary (collapse)

Constructor Details

- (CostEvaluator) initialize(&evaluator)

A new instance of CostEvaluator



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

def initialize(&evaluator)
  @evaluator = evaluator
end

Instance Method Details

- (Object) get_cost(relationship, direction)

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