Class: ValueGraphTransformation::Arithmetic::Add

Inherits:
Function show all
Defined in:
lib/value_graph_transformation/arithmetic.rb

Overview

Addition

Instance Attribute Summary

Attributes inherited from Graph::Vertex

#sources, #targets

Instance Method Summary (collapse)

Methods inherited from Graph::Vertex

#initialize, #source_vertices, #target_vertices

Constructor Details

This class inherits a constructor from ValueGraphTransformation::Graph::Vertex

Instance Method Details

- (Class, Array<Vertex>) inverse_to(source)

Returns the inverse function and its parameters

Returns:

  • (Class, Array<Vertex>, Array<Vertex>)

    the inverse function and its parameters



102
103
104
105
106
# File 'lib/value_graph_transformation/arithmetic.rb', line 102

def inverse_to(source)
  fail "Function does not contain given source" unless source_vertices.include?(source)
  other_source = source_vertices - [source]
  [Sub, target_vertices + other_source, [source]]
end

- (String) symbol

Returns the symbol that represents this function.

Returns:

  • (String)

    the symbol that represents this function.



97
98
99
# File 'lib/value_graph_transformation/arithmetic.rb', line 97

def symbol
  "+"
end