Class ACountable<E extends ACell>

Type Parameters:
E - Type of element that is counted
All Implemented Interfaces:
IValidated, IWriteable
Direct Known Subclasses:
ABlobLike, ADataStructure

public abstract class ACountable<E extends ACell> extends ACell
Abstract base class for Countable objects. Countable values support a count of elements and the ability to get by an element index.
  • Constructor Details

    • ACountable

      public ACountable()
  • Method Details

    • count

      public abstract long count()
      Returns the number of elements in this data structure
      Returns:
      Number of elements in this collection.
    • get

      public abstract E get(long index)
      Gets the element at the specified element index in this collection
      Parameters:
      index - Index of element to get
      Returns:
      Element at the specified index
    • getElementRef

      public abstract Ref<E> getElementRef(long index)
      Gets a Ref to the element at the specified element index in this collection
      Parameters:
      index - Index of element to get
      Returns:
      Element at the specified index
    • isEmpty

      public boolean isEmpty()
      Checks if this data structure is empty, i.e. has a count of zero elements.
      Returns:
      true if this data structure is empty, false otherwise
    • empty

      public abstract ACountable<E> empty()
      Returns a canonical, singleton empty instance of the same type as this Countable value.
      Returns:
      An empty Countable value
    • size

      public int size()
      Gets the size of this data structure as an int. Returns Integer.MAX_SIZE if the count is larger than can fit in an int. If this might be a problem, use count() instead.
      Returns:
      Number of elements in this collection.
    • slice

      public abstract ACountable<E> slice(long start, long end)
      Gets a slice of this data structure
      Parameters:
      start - Start index (inclusive)
      end - end index (exclusive)
      Returns:
      Slice of data structure, or null if invalid slice
    • slice

      public ACountable<E> slice(long start)
      Gets a slice of this data structure from start to the end
      Parameters:
      start - Start index (inclusive)
      Returns:
      Slice of data structure, or null if invalid slice