Module syntaxnbt

Class TagArray<N extends Number,T>

java.lang.Object
at.syntaxerror.syntaxnbt.tag.Tag<T>
at.syntaxerror.syntaxnbt.tag.TagArray<N,T>
Type Parameters:
T - type of the number stored in this array
N - type of the array stored in this tag
Direct Known Subclasses:
TagByteArray, TagIntArray, TagLongArray

public abstract class TagArray<N extends Number,T> extends Tag<T>
Author:
SyntaxError404
  • Constructor Details

    • TagArray

      protected TagArray(TagType type, T array)
      Constructs an array of the specified type
      Parameters:
      type - type of elements in this array
      array - array of elements
  • Method Details

    • checkBounds

      protected void checkBounds(int index)
      Checks if the index lies within the bounds of the list (for set(int, Number))
      Parameters:
      index - the index
    • checkBoundsExclusive

      protected void checkBoundsExclusive(int index)
      Checks if the index lies within the bounds of the list (for add(int, Number))
      Parameters:
      index - the index
    • set

      public abstract TagArray<N,T> set(int index, Number value)
      Replaces an element at the specified position in the array
      Parameters:
      index - index of the element to replace
      value - the element to be stored at the specified position
      Returns:
      this array
    • setTag

      public TagArray<N,T> setTag(int index, TagNumber<?> value)
      Replaces an element at the specified position in the array
      Parameters:
      index - index of the element to replace
      value - the element to be stored at the specified position
      Returns:
      this array
    • add

      public TagArray<N,T> add(Number value)
      Add an element to the array
      Parameters:
      value - the element to be added
      Returns:
      this array
    • addTag

      public TagArray<N,T> addTag(TagNumber<?> value)
      Add an element to the array
      Parameters:
      value - the element to be added
      Returns:
      this array
    • add

      public TagArray<N,T> add(int index, Number value)
      Inserts an element at the specified position in the array
      Parameters:
      index - index at which the specified element is to be inserted
      value - element to be added
      Returns:
      this array
    • addTag

      public TagArray<N,T> addTag(int index, TagNumber<?> value)
      Inserts an element at the specified position in the array
      Parameters:
      index - index at which the specified element is to be inserted
      value - element to be added
      Returns:
      this array
    • get

      public abstract N get(int index)
      Returns the element at the specified position in this array
      Parameters:
      index - index of the element to be returned
      Returns:
      the element at the specified position in this array
    • getTag

      public abstract TagNumber<N> getTag(int index)
      Returns the tag at the specified position in this array as a TagNumber
      Parameters:
      index - index of the element to be returned
      Returns:
      the element at the specified position in this array
    • size

      public int size()
      Returns the number of elements in this array
      Returns:
      the number of elements in this array
    • remove

      public TagArray<N,T> remove(int index)
      Removes the element at the specified position in this array
      Parameters:
      index - index of the element to be removed
      Returns:
      this array
    • clear

      public TagArray<N,T> clear()
      Removes all of the elements from this array
      Returns:
      this array
    • getArrayType

      public Class<T> getArrayType()
      Returns the type of the array
      Returns:
      the type of the array