Class: Quicopt::Placement 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 permutation: the item in a slot, or the slot of an item. One factor of an Expression, standing for its value counted from 0.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(permutation, op, position, order) ⇒ Placement

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 Placement.



342
343
344
345
346
347
348
# File 'lib/quicopt/structured.rb', line 342

def initialize(permutation, op, position, order)
  @permutation = permutation
  @op = op
  @position = position
  @order = order
  freeze
end

Instance Attribute Details

#op ⇒ Symbol (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 :item_at or :slot_of.

Returns:

  • (Symbol) —

    :item_at or :slot_of



336
337
338
# File 'lib/quicopt/structured.rb', line 336

def op
  @op
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



340
341
342
# File 'lib/quicopt/structured.rb', line 340

def order
  @order
end

#permutation ⇒ Permutation (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:



334
335
336
# File 'lib/quicopt/structured.rb', line 334

def permutation
  @permutation
end

#position ⇒ Integer (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 slot (for :item_at) or the item (for :slot_of).

Returns:

  • (Integer) —

    the slot (for :item_at) or the item (for :slot_of)



338
339
340
# File 'lib/quicopt/structured.rb', line 338

def position
  @position
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:



351
352
353
# File 'lib/quicopt/structured.rb', line 351

def model
  @permutation.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. route.item_at(0).

Returns:

  • (String) —

    the read as written, e.g. route.item_at(0)



361
362
363
# File 'lib/quicopt/structured.rb', line 361

def to_s
  "#{@permutation.name}.#{@op}(#{@position})"
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 none: a read of a permutation involves no variable.

Returns:

  • (Array<Variable>) —

    none: a read of a permutation involves no variable



356
357
358
# File 'lib/quicopt/structured.rb', line 356

def variables
  []
end