Class ACountable<E extends ACell>

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

public abstract class ACountable<E extends ACell> extends ACell
Abstract base class for Countable objects. Countable values support a count of sub-elements and the ability to get by 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 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 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
    • 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.