Class: Quicopt::PartRead 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 partition: the part of an item (counted from 0), or the number of items in a part. One factor of an Expression.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(partition, op, position, order) ⇒ PartRead

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



380
381
382
383
384
385
386
# File 'lib/quicopt/structured.rb', line 380

def initialize(partition, op, position, order)
  @partition = partition
  @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 :part_of or :size_of.

Returns:

  • (Symbol) —

    :part_of or :size_of



374
375
376
# File 'lib/quicopt/structured.rb', line 374

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



378
379
380
# File 'lib/quicopt/structured.rb', line 378

def order
  @order
end

#partition ⇒ Partition (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:



372
373
374
# File 'lib/quicopt/structured.rb', line 372

def partition
  @partition
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 item (for :part_of) or the part (for :size_of).

Returns:

  • (Integer) —

    the item (for :part_of) or the part (for :size_of)



376
377
378
# File 'lib/quicopt/structured.rb', line 376

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:



389
390
391
# File 'lib/quicopt/structured.rb', line 389

def model
  @partition.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. teams.part_of(2).

Returns:

  • (String) —

    the read as written, e.g. teams.part_of(2)



399
400
401
# File 'lib/quicopt/structured.rb', line 399

def to_s
  "#{@partition.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 partition involves no variable.

Returns:

  • (Array<Variable>) —

    none: a read of a partition involves no variable



394
395
396
# File 'lib/quicopt/structured.rb', line 394

def variables
  []
end