Class: Veritas::Optimizer::PredicatePartition

Inherits:
Object
  • Object
show all
Includes:
Immutable
Defined in:
lib/veritas/optimizer/support/predicate_partition.rb

Overview

Partition a predicate to distribute it over binary operations

Constant Summary collapse

TAUTOLOGY =
Veritas::Function::Proposition::Tautology.instance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(predicate, left_header, right_header) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a Predication Partition

Examples:

partition = PredicatePartition.new(predicate, left_header, right_header)

Parameters:

  • predicate (Function)
  • left_header (Header)
  • right_header (Header)


47
48
49
50
51
52
53
54
55
56
# File 'lib/veritas/optimizer/support/predicate_partition.rb', line 47

def initialize(predicate, left_header, right_header)
  @left      = TAUTOLOGY
  @right     = TAUTOLOGY
  @remainder = TAUTOLOGY

  @left_header  = left_header
  @right_header = right_header

  partition!(predicate)
end

Instance Attribute Details

#leftFunction (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the predicate for the left header

Returns:



17
18
19
# File 'lib/veritas/optimizer/support/predicate_partition.rb', line 17

def left
  @left
end

#remainderFunction (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the remainder predicate

Returns:



31
32
33
# File 'lib/veritas/optimizer/support/predicate_partition.rb', line 31

def remainder
  @remainder
end

#rightFunction (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the predicate for the right header

Returns:



24
25
26
# File 'lib/veritas/optimizer/support/predicate_partition.rb', line 24

def right
  @right
end