Ring

io.github.scala_tessella.ring_seq.examples.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

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

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.

Attributes

Returns

the rotated and reflected sequence.

def currentHead: A

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.

Attributes

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.

Attributes

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

Attributes

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

Attributes

Concrete fields

var isReflected: Boolean