Sha256: 8518a61b58b8758cc7850918b692589cbf386211aa3cec215dcee5d29ca07ac7

Contents?: true

Size: 771 Bytes

Versions: 4

Compression:

Stored size: 771 Bytes

Contents

module Neo4j
  module Functions

    class Sum < Function
      # Updates the function's value.
      # Called after the transactions commits and a property has been changed on a node.
      #
      # ==== Arguments
      # * rule_name :: the name of the rule group
      # * rule_node :: the node which contains the value of this function
      # * old_value new value :: the changed value of the property (when the transaction commits)
      def update(rule_name, rule_node, old_value, new_value)
        key            = rule_node_property(rule_name)
        rule_node[key] ||= 0
        old_value      ||= 0
        new_value      ||= 0
        rule_node[key] += new_value - old_value
      end

      def self.function_name
        :sum
      end
    end


  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
neo4j-1.0.0.beta.27-java lib/neo4j/functions/sum.rb
neo4j-1.0.0.beta.26-java lib/neo4j/functions/sum.rb
neo4j-1.0.0.beta.25-java lib/neo4j/functions/sum.rb
neo4j-1.0.0.beta.24-java lib/neo4j/functions/sum.rb