Ring

class Ring[A](underlying: Seq[A], var headIndex: IndexO, var isReflected: Boolean)

An example class wrapping a sequence and keeping a mutable state of rotation and reflection

Type parameters:
A

the type of the elements in the sequence

Value parameters:
headIndex

mutable state of rotation, a circular index of the sequence head

isReflected

mutable state of reflection

underlying

the wrapped sequence

class Object
trait Matchable
class Any

Value members

Concrete methods

def current: Seq[A]

Gets the sequence at the current state of rotation and reflection.

Gets the sequence at the current state of rotation and reflection.

Returns:

the rotated and reflected sequence.

Gets the head element of the sequence at the current state of rotation and reflection.

Gets the head element of the sequence at the current state of rotation and reflection.

Returns:

the element at the head of the rotated and reflected sequence.

def reflect(): Unit

Adds a reflection, the sequence is considered as flowing in the opposite direction.

Adds a reflection, the sequence is considered as flowing in the opposite direction.

def rotateL(step: Int): Unit

Adds a rotation to the left by some steps.

Adds a rotation to the left by some steps.

Value parameters:
step

Int

def rotateR(step: Int): Unit

Adds a rotation to the right by some steps.

Adds a rotation to the right by some steps.

Value parameters:
step

Int

Concrete fields

var isReflected: Boolean