Class TraitVecInternal

java.lang.Object
org.kink_lang.kink.internal.vec.VecInternal
org.kink_lang.kink.internal.vec.TraitVecInternal
All Implemented Interfaces:
MaybeTrait

public final class TraitVecInternal extends VecInternal implements MaybeTrait
Immutable vec internal for elements like ['A' a 'B' b 'C' c].
  • Method Details

    • getTraitVars

      public SharedVars getTraitVars()
      Returns the trait vars.
      Returns:
      the trait vars.
    • getTrait

      public TraitVecInternal getTrait()
      Description copied from class: VecInternal
      Returns the trait vec internal equal to this if possible; otherwise null.
      Specified by:
      getTrait in class VecInternal
      Returns:
      the trait vec internal equal to this if possible, or null.
    • set

      @CheckReturnValue public VecInternal set(int index, Val val)
      Description copied from class: VecInternal
      Sets the indexed element.

      This is a linear update make.

      Specified by:
      set in class VecInternal
      Parameters:
      index - the index.
      val - the element val.
      Returns:
      this.
    • remove

      @CheckReturnValue public VecInternal remove(int index)
      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 class VecInternal
      Parameters:
      index - the index.
      Returns:
      this.
    • removeRange

      @CheckReturnValue public VecInternal removeRange(int from, int to)
      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 class VecInternal
      Parameters:
      from - the beginning index of the range (inclusive).
      to - the end index of the range (exclusive).
      Returns:
      this.
    • insert

      @CheckReturnValue public VecInternal insert(int index, Val val)
      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 class VecInternal
      Parameters:
      index - the position index.
      val - the inserted val.
      Returns:
      the result vec internal; it may be this.
    • insertAll

      @CheckReturnValue public VecInternal insertAll(int index, VecInternal added)
      Description copied from class: VecInternal
      Inserts the elements of added to the position index.

      This is a linear update make.

      Precondition: 0 <= index <= capa.

      Specified by:
      insertAll in class VecInternal
      Parameters:
      index - the position index.
      added - the added vec internal.
      Returns:
      the result vec internal; it may be this.
    • insertRange

      @CheckReturnValue public VecInternal insertRange(int index, Val[] src, int from, int to)
      Description copied from class: VecInternal
      Inserts the elements in the range of src to the position index.

      This is a linear update make.

      Precondition: 0 <= index <= capa, 0 <= from <= to < src.length.

      Specified by:
      insertRange in class VecInternal
      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.