Class ExtendedIterableIntervalView<E>

java.lang.Object
ch.nolix.base.datastructure.extendediterable.AbstractExtendedIterable<E>
ch.nolix.base.datastructure.extendediterableintervalview.ExtendedIterableIntervalView<E>
Type Parameters:
E - the type of the elements of a ExtendedIterableIntervalView
All Implemented Interfaces:
ArrayMappable<E>, IndexRequestable<E>, IterableWithCopyableIterator<E>, SingleSearchable<E>, StoringRequestable<E>, StringMappable, ExtendedIterable<E>, Filterable<E>, FilteringContainerViewProvider<E>, Groupable<E>, IntervallContainerViewProvider<E>, Mappable<E>, MappingContainerViewProvider<E>, AggregationRequestable<E>, CountRequestable<E>, EmptinessRequestable, MaterializationRequestable, Iterable<E>

public final class ExtendedIterableIntervalView<E> extends AbstractExtendedIterable<E>
A ExtendedIterableIntervalView can iterate over an intervall of a ExtendedIterable.
Author:
Silvan Wyss
  • Method Details

    • forExtendedIterableAndStartIndexAndEndIndex

      public static <T> ExtendedIterableIntervalView<T> forExtendedIterableAndStartIndexAndEndIndex(ExtendedIterable<T> extendedIterable, int startIndex, int endIndex)
      Type Parameters:
      T - is the type of the elements of the created ExtendedIterableIntervalView.
      Parameters:
      extendedIterable -
      startIndex -
      endIndex -
      Returns:
      a new ExtendedIterableIntervalView with the given extendedIterable, startIndex and endIndex.
      Throws:
      RuntimeException - if the given extendedIterable is null
      RuntimeException - if the given startIndex is not positive.
      RuntimeException - if the given endIndex is not positive.
      RuntimeException - if the given endIndex is smaller than the given startIndex.
      RuntimeException - if the given endIndex is bigger than the number of elements of the given extendedIterable.
    • getCount

      public int getCount()
      Returns:
      the number of elements of the current CountRequestable.
    • getStoredAtOneBasedIndex

      public E getStoredAtOneBasedIndex(int oneBasedIndex)
      Parameters:
      oneBasedIndex -
      Returns:
      the element at the given oneBasedIndex. The element can be null.
    • isMaterialized

      public boolean isMaterialized()
      Returns:
      true if the current MaterializationRequestable is materialized, false otherwise.
    • iterator

      public CopyableIterator<E> iterator()
    • toString

      public String toString()
      Overrides:
      toString in class Object