Package generic.stl
Class EmptyIteratorSTL<T>
- java.lang.Object
-
- generic.stl.EmptyIteratorSTL<T>
-
- All Implemented Interfaces:
IteratorSTL<T>
public class EmptyIteratorSTL<T> extends java.lang.Object implements IteratorSTL<T>
-
-
Constructor Summary
Constructors Constructor Description EmptyIteratorSTL()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(IteratorSTL<T> otherIterator)
'Assigns' this iterator to be equivalent to the given iterator.IteratorSTL<T>
copy()
Creates a copy of this iterator.IteratorSTL<T>
decrement()
Devance the iterator to the previous position.IteratorSTL<T>
decrement(int n)
Devances the iterator n positions.void
delete()
void
delete(int count)
T
get()
Returns the current value of the iterator.IteratorSTL<T>
increment()
Advances the iterator to the next position.IteratorSTL<T>
increment(int n)
Advances the iterator n positions.void
insert(T value)
Inserts the given value at the current position (the current value will be pushed to the next value).boolean
isBegin()
Returns true if the iterator is positioned on the first first element of the collection.boolean
isEnd()
Returns true if the iterator is positioned past the last element of the collection.boolean
isRBegin()
boolean
isREnd()
void
set(T value)
Sets the current value of the iterator to the given value.
-
-
-
Method Detail
-
copy
public IteratorSTL<T> copy()
Description copied from interface:IteratorSTL
Creates a copy of this iterator.- Specified by:
copy
in interfaceIteratorSTL<T>
- Returns:
- a copy of this iterator.
-
delete
public void delete()
-
delete
public void delete(int count)
-
get
public T get()
Description copied from interface:IteratorSTL
Returns the current value of the iterator.- Specified by:
get
in interfaceIteratorSTL<T>
- Returns:
- the current value of the iterator.
-
increment
public IteratorSTL<T> increment()
Description copied from interface:IteratorSTL
Advances the iterator to the next position.- Specified by:
increment
in interfaceIteratorSTL<T>
- Returns:
- a reference to the iterator itself
-
decrement
public IteratorSTL<T> decrement()
Description copied from interface:IteratorSTL
Devance the iterator to the previous position. This method is only supported in bidirectional iterators.- Specified by:
decrement
in interfaceIteratorSTL<T>
- Returns:
- a reference to the iterator itself
-
insert
public void insert(T value)
Description copied from interface:IteratorSTL
Inserts the given value at the current position (the current value will be pushed to the next value). The iterator will be positioned on the new value.- Specified by:
insert
in interfaceIteratorSTL<T>
- Parameters:
value
- the value to insert into the collection.
-
isBegin
public boolean isBegin()
Description copied from interface:IteratorSTL
Returns true if the iterator is positioned on the first first element of the collection. If the collection is empty, this will always return false.- Specified by:
isBegin
in interfaceIteratorSTL<T>
- Returns:
- true if the iterator is positioned on the first element of the collection.
-
isEnd
public boolean isEnd()
Description copied from interface:IteratorSTL
Returns true if the iterator is positioned past the last element of the collection. If the collection is empty, this will always return true.- Specified by:
isEnd
in interfaceIteratorSTL<T>
- Returns:
- true if the iterator is positioned past the last element of the collection.
-
set
public void set(T value)
Description copied from interface:IteratorSTL
Sets the current value of the iterator to the given value.- Specified by:
set
in interfaceIteratorSTL<T>
- Parameters:
value
- the value to set at the iterator position
-
decrement
public IteratorSTL<T> decrement(int n)
Description copied from interface:IteratorSTL
Devances the iterator n positions.- Specified by:
decrement
in interfaceIteratorSTL<T>
- Returns:
- a reference to the iterator itself
-
increment
public IteratorSTL<T> increment(int n)
Description copied from interface:IteratorSTL
Advances the iterator n positions.- Specified by:
increment
in interfaceIteratorSTL<T>
- Returns:
- a reference to the iterator itself
-
isRBegin
public boolean isRBegin()
-
isREnd
public boolean isREnd()
-
assign
public void assign(IteratorSTL<T> otherIterator)
Description copied from interface:IteratorSTL
'Assigns' this iterator to be equivalent to the given iterator. This is equivalent to C++'s '=' overloading mechanism- Specified by:
assign
in interfaceIteratorSTL<T>
- Parameters:
otherIterator
- The iterator to copy
-
-