Class IntMemoryDataStorage.ReadWriteIterator

    • Field Detail

      • data

        private int[] data
      • position

        private int position
      • length

        private int length
    • Constructor Detail

      • ReadWriteIterator

        public ReadWriteIterator​(long startPosition,
                                 long endPosition)
                          throws java.lang.IllegalArgumentException,
                                 java.lang.IllegalStateException,
                                 ApfloatRuntimeException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalStateException
        ApfloatRuntimeException
      • ReadWriteIterator

        protected ReadWriteIterator​(int mode,
                                    long startPosition,
                                    long endPosition)
                             throws java.lang.IllegalArgumentException,
                                    java.lang.IllegalStateException,
                                    ApfloatRuntimeException
        Throws:
        java.lang.IllegalArgumentException
        java.lang.IllegalStateException
        ApfloatRuntimeException
    • Method Detail

      • hasNext

        public boolean hasNext()
        Description copied from class: DataStorage.AbstractIterator
        Check if next() can be called without going past the end of the sequence. That is, if next() can be called without deliberately causing an exception.

        Note: It is important that the iterator is iterated past the last element; that is next() is called startPosition - endPosition times. The get() or set() methods should not be called for the last element.

        Overrides:
        hasNext in class DataStorage.AbstractIterator
        Returns:
        true if DataStorage.AbstractIterator.next() can be called, otherwise false.
      • next

        public void next()
                  throws java.lang.IllegalStateException
        Description copied from class: DataStorage.AbstractIterator
        Advances the position in the stream by one element.

        Note: It is important that the iterator is iterated past the last element; that is next() is called startPosition - endPosition times. The get() or set() methods should not be called for the last element.

        Overrides:
        next in class DataStorage.AbstractIterator
        Throws:
        java.lang.IllegalStateException - If the iterator has been iterated to the end already.
      • setInt

        public void setInt​(int value)
                    throws java.lang.IllegalStateException
        Description copied from class: DataStorage.Iterator
        Sets the current element as an int.

        The default implementation calls DataStorage.Iterator.set(Class,Object) with first argument Integer.TYPE.

        Overrides:
        setInt in class DataStorage.AbstractIterator
        Parameters:
        value - The value to be set to the current element as an int.
        Throws:
        java.lang.IllegalStateException - If the iterator is at the end.
      • get

        public <T> T get​(java.lang.Class<T> type)
                  throws java.lang.UnsupportedOperationException,
                         java.lang.IllegalStateException
        Description copied from class: DataStorage.Iterator
        Gets the current element as a the specified element type.

        The default implementation always throws UnsupportedOperationException.

        Overrides:
        get in class DataStorage.Iterator
        Type Parameters:
        T - The type of the element.
        Parameters:
        type - The type of the element.
        Returns:
        The current element as the specified type.
        Throws:
        java.lang.UnsupportedOperationException - If the element type of the data storage can't be converted to the specified type.
        java.lang.IllegalStateException - If the iterator is at the end.
      • set

        public <T> void set​(java.lang.Class<T> type,
                            T value)
                     throws java.lang.UnsupportedOperationException,
                            java.lang.IllegalArgumentException,
                            java.lang.IllegalStateException
        Description copied from class: DataStorage.Iterator
        Sets the current element as the specified element type.

        The default implementation always throws UnsupportedOperationException.

        Overrides:
        set in class DataStorage.Iterator
        Type Parameters:
        T - The type of the element.
        Parameters:
        type - The type of the element.
        value - The value to be set to the current element as the specified type.
        Throws:
        java.lang.UnsupportedOperationException - If the element type of the data storage can't be converted to the specified type.
        java.lang.IllegalArgumentException - If the value is not of the specified type.
        java.lang.IllegalStateException - If the iterator is at the end.