BUG-7464: Refactor TrieMapIterator 83/49983/14
authorRobert Varga <rovarga@cisco.com>
Tue, 3 Jan 2017 16:41:08 +0000 (17:41 +0100)
committerRobert Varga <nite@hq.sk>
Tue, 10 Jan 2017 23:44:43 +0000 (23:44 +0000)
commitfa324c628d5bf5753b22c9c54224a9b885dc2227
treeae0cf4a969ff2be12395ea5873513dd6f2330835
parentff3a186d75711a020e19f10088df06e7ac95759c
BUG-7464: Refactor TrieMapIterator

This eliminates unused code and re-organizes the type hierarchy
so we have an abstract base iterator specialized for mutable
and immutable cases. This allows the immutable iterator to not
track the last returned entry, making a bit lighter-weight.

Futhermore use of iterator in LNode is removed, as LNodeEntries
can simply be used the traverse the list without object allocation.

Finally it restores assumptions made by original Scala code, which
is that the base map for an iterator, used to access, is a read-only
one. This was probably damaged during initial Java porting, as
Scala iterators are read-only and the ability to mutate was added.

The was done without differentiating the iteration (read-only) map
from the mutation map (read-write).

Change-Id: I7949cde0712e3e02de1846a51b6dd0d3704bea58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/AbstractIterator.java [new file with mode: 0644]
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/ImmutableIterator.java [new file with mode: 0644]
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/ImmutableTrieMap.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/LNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/LNodeEntries.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/MutableIterator.java [new file with mode: 0644]
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/MutableTrieMap.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TrieMap.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TrieMapIterator.java [deleted file]
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TrieMapReadOnlyIterator.java [deleted file]
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/TestMapIterator.java