Package generic.stl
Class MapIteratorSTL<K,V>
- java.lang.Object
-
- generic.stl.MapIteratorSTL<K,V>
-
- All Implemented Interfaces:
IteratorSTL<Pair<K,V>>
- Direct Known Subclasses:
ReverseMapIteratorSTL
public class MapIteratorSTL<K,V> extends java.lang.Object implements IteratorSTL<Pair<K,V>>
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
erased
protected RedBlackNode<K,V>
node
protected RedBlackTree<K,V>
tree
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(IteratorSTL<Pair<K,V>> otherIterator)
'Assigns' this iterator to be equivalent to the given iterator.IteratorSTL<Pair<K,V>>
copy()
Creates a copy of this iterator.IteratorSTL<Pair<K,V>>
decrement()
Devance the iterator to the previous position.IteratorSTL<Pair<K,V>>
decrement(int n)
Devances the iterator n positions.boolean
equals(java.lang.Object obj)
Pair<K,V>
get()
Returns the current value of the iterator.IteratorSTL<Pair<K,V>>
increment()
Advances the iterator to the next position.IteratorSTL<Pair<K,V>>
increment(int n)
Advances the iterator n positions.void
insert(Pair<K,V> 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.void
set(Pair<K,V> value)
Sets the current value of the iterator to the given value.
-
-
-
Field Detail
-
tree
protected RedBlackTree<K,V> tree
-
node
protected RedBlackNode<K,V> node
-
erased
protected boolean erased
-
-
Method Detail
-
assign
public void assign(IteratorSTL<Pair<K,V>> 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<K>
- Parameters:
otherIterator
- The iterator to copy
-
decrement
public IteratorSTL<Pair<K,V>> 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<K>
- Returns:
- a reference to the iterator itself
-
get
public Pair<K,V> get()
Description copied from interface:IteratorSTL
Returns the current value of the iterator.- Specified by:
get
in interfaceIteratorSTL<K>
- Returns:
- the current value of the iterator.
-
increment
public IteratorSTL<Pair<K,V>> increment()
Description copied from interface:IteratorSTL
Advances the iterator to the next position.- Specified by:
increment
in interfaceIteratorSTL<K>
- Returns:
- a reference to the iterator itself
-
insert
public void insert(Pair<K,V> 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<K>
- 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<K>
- 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<K>
- Returns:
- true if the iterator is positioned past the last element of the collection.
-
set
public void set(Pair<K,V> value)
Description copied from interface:IteratorSTL
Sets the current value of the iterator to the given value.- Specified by:
set
in interfaceIteratorSTL<K>
- Parameters:
value
- the value to set at the iterator position
-
copy
public IteratorSTL<Pair<K,V>> copy()
Description copied from interface:IteratorSTL
Creates a copy of this iterator.- Specified by:
copy
in interfaceIteratorSTL<K>
- Returns:
- a copy of this iterator.
-
decrement
public IteratorSTL<Pair<K,V>> decrement(int n)
Description copied from interface:IteratorSTL
Devances the iterator n positions.- Specified by:
decrement
in interfaceIteratorSTL<K>
- Returns:
- a reference to the iterator itself
-
increment
public IteratorSTL<Pair<K,V>> increment(int n)
Description copied from interface:IteratorSTL
Advances the iterator n positions.- Specified by:
increment
in interfaceIteratorSTL<K>
- Returns:
- a reference to the iterator itself
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-