Class: Quicopt::TableEntry Private

Inherits:
Object
  • Object
show all
Defined in:
lib/quicopt/structured.rb

Overview

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

A read of a lookup table at positions given by expressions. One factor of an Expression.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, index, order) ⇒ TableEntry

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 a new instance of TableEntry.



416
417
418
419
420
421
# File 'lib/quicopt/structured.rb', line 416

def initialize(table, index, order)
  @table = table
  @index = index
  @order = order
  freeze
end

Instance Attribute Details

#index ⇒ Array<Expression> (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 one position per dimension, counted from 0.

Returns:

  • (Array<Expression>) —

    one position per dimension, counted from 0



412
413
414
# File 'lib/quicopt/structured.rb', line 412

def index
  @index
end

#order ⇒ Array (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 where this term sorts among a model's terms.

Returns:

  • (Array) —

    where this term sorts among a model's terms



414
415
416
# File 'lib/quicopt/structured.rb', line 414

def order
  @order
end

#table ⇒ LookupTable (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:



410
411
412
# File 'lib/quicopt/structured.rb', line 410

def table
  @table
end

Instance Method Details

#model ⇒ Model

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:



424
425
426
# File 'lib/quicopt/structured.rb', line 424

def model
  @table.model
end

#to_s ⇒ String

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 read as written, e.g. dist[route.item_at(0), route.item_at(1)].

Returns:

  • (String) —

    the read as written, e.g. dist[route.item_at(0), route.item_at(1)]



434
435
436
# File 'lib/quicopt/structured.rb', line 434

def to_s
  "#{@table.name}[#{@index.join(', ')}]"
end

#variables ⇒ Array<Variable>

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 variables the positions mention.

Returns:

  • (Array<Variable>) —

    the variables the positions mention



429
430
431
# File 'lib/quicopt/structured.rb', line 429

def variables
  @index.flat_map(&:variables).uniq
end