java.lang.Object
org.kink_lang.kink.internal.vec.VecInternal
org.kink_lang.kink.internal.vec.TraitVecInternal
- All Implemented Interfaces:
MaybeTrait
Immutable vec internal for elements
like ['A' a 'B' b 'C' c].
-
Method Summary
Modifier and TypeMethodDescriptiongetTrait()
Returns the trait vec internal equal tothis
if possible; otherwise null.Returns the trait vars.Inserts a val to the position index.insertAll
(int index, VecInternal added) Inserts the elements ofadded
to the position index.insertRange
(int index, Val[] src, int from, int to) Inserts the elements in the range ofsrc
to the position index.remove
(int index) Removes the indexed element from the vec internal.removeRange
(int from, int to) Removes the range between the indices from the vec internal.Sets the indexed element.
-
Method Details
-
getTraitVars
Returns the trait vars.- Returns:
- the trait vars.
-
getTrait
Description copied from class:VecInternal
Returns the trait vec internal equal tothis
if possible; otherwise null.- Specified by:
getTrait
in classVecInternal
- Returns:
- the trait vec internal equal to
this
if possible, or null.
-
set
Description copied from class:VecInternal
Sets the indexed element.This is a linear update make.
- Specified by:
set
in classVecInternal
- Parameters:
index
- the index.val
- the element val.- Returns:
- this.
-
remove
Description copied from class:VecInternal
Removes the indexed element from the vec internal.This is a linear update make.
Precondition: 0 <= index < capa.
- Specified by:
remove
in classVecInternal
- Parameters:
index
- the index.- Returns:
- this.
-
removeRange
Description copied from class:VecInternal
Removes the range between the indices from the vec internal.This is a linear update make.
Precondition: 0 <= from <= to <= capa.
- Specified by:
removeRange
in classVecInternal
- Parameters:
from
- the beginning index of the range (inclusive).to
- the end index of the range (exclusive).- Returns:
- this.
-
insert
Description copied from class:VecInternal
Inserts a val to the position index.This is a linear update make.
Precondition: 0 <= index <= capa.
- Specified by:
insert
in classVecInternal
- Parameters:
index
- the position index.val
- the inserted val.- Returns:
- the result vec internal; it may be
this
.
-
insertAll
Description copied from class:VecInternal
Inserts the elements ofadded
to the position index.This is a linear update make.
Precondition: 0 <= index <= capa.
- Specified by:
insertAll
in classVecInternal
- Parameters:
index
- the position index.added
- the added vec internal.- Returns:
- the result vec internal; it may be
this
.
-
insertRange
Description copied from class:VecInternal
Inserts the elements in the range ofsrc
to the position index.This is a linear update make.
Precondition: 0 <= index <= capa, 0 <= from <= to < src.length.
- Specified by:
insertRange
in classVecInternal
- Parameters:
index
- the position index.src
- array containing the added vals.from
- the from index of the src.to
- the to index of the src.- Returns:
- the result vec internal; it may be
this
.
-