View Source Tablex.Optimizer.Helper (tablex v0.3.1)

Link to this section Summary

Functions

Check if a input condition covers by another.

Fix ids of rules.

Check if an output is meaningful. A meaningful output is one that does not contain all :any elements.

Merge two input stubs

Merge two inputs.

Merge two outputs. Stub value with higher priority wins.

Order an already sorted, list of rules by hit policy.

Order a list of table rules by priority, high to low.

Sort the rules according to a hit policy.

Link to this section Types

@type order() :: :h2l | :l2h
@type rule() :: Tablex.Table.rule()

Link to this section Functions

Link to this function

cover_input?(input, input)

View Source
@spec cover_input?(covering :: any(), target :: any()) :: boolean()

Check if a input condition covers by another.

Link to this function

cover_output?(output, output)

View Source
Link to this function

exclusive?(input1, input2)

View Source
@spec fix_ids([rule()]) :: [rule()]

Fix ids of rules.

Link to this function

input_mergeable?(input1, input2)

View Source
Link to this function

meaningful_output?(output)

View Source

Check if an output is meaningful. A meaningful output is one that does not contain all :any elements.

Link to this function

merge_input_stubs(expr, expr)

View Source

Merge two input stubs

Link to this function

merge_inputs(input1, input2)

View Source

Merge two inputs.

Link to this function

merge_outputs(high_output, low_output)

View Source

Merge two outputs. Stub value with higher priority wins.

example

Example

iex > merge_outputs([1, 2, 3], [2, 4, 6]) [1, 2, 3]

iex > merge_outputs([:any, 2, :any], [2, :any, 6]) [2, 2, 6]

Link to this function

order_by_priority(rules, arg2, arg3)

View Source
@spec order_by_priority(
  [rule()],
  current_order :: order(),
  Tablex.HitPolicy.hit_policy()
) :: [rule()]

Order an already sorted, list of rules by hit policy.

Link to this function

order_by_priority_high_to_lower(rules, hp)

View Source

Order a list of table rules by priority, high to low.

Link to this function

sort_rules(rules, hit_policy)

View Source

Sort the rules according to a hit policy.

Link to this function

stub_covers?(same, same)

View Source