Package org.jibx.schema.elements
Class FilteredSegmentList
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
org.jibx.schema.elements.FilteredSegmentList
- All Implemented Interfaces:
Iterable
,Collection
,List
,SequencedCollection
Virtual list generated from a backing list by filtering on the element types.
This exposes a segment of the backing list through the filter, with multiple
filters used to expose the entire backing list piecemeal. It can only be used
with lists of elements.
- Author:
- Dennis M. Sosnoski
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
Last modify count matching cached values.private final LazyList
Base list.private final long
Mask for element types to match in filter.private final OpenAttrBase
Element owning this list.private final FilteredSegmentList
Filter for elements prior to this filter in list.private int
Cached size of filtered list.private int
Cached filtered list start index in base list.Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Dummy default constructor for unmarshalling.FilteredSegmentList
(LazyList list, long match, FilteredSegmentList prior, OpenAttrBase owner) Constructor with everything specified.FilteredSegmentList
(LazyList list, long match, OpenAttrBase owner) Constructor with no prior filter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
get
(int index) remove
(int index) Removes the item at the index position.boolean
protected void
removeRange
(int from, int to) private void
Update modify count to show cached state is current.int
size()
private void
sync()
Synchronize filter to current list state.Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, subList
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addAll, addFirst, addLast, contains, containsAll, getFirst, getLast, isEmpty, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray, toArray
-
Field Details
-
m_list
Base list. -
m_matchBits
private final long m_matchBitsMask for element types to match in filter. -
m_prior
Filter for elements prior to this filter in list. -
m_owner
Element owning this list. -
m_lastModify
private int m_lastModifyLast modify count matching cached values. -
m_startIndex
private int m_startIndexCached filtered list start index in base list. -
m_size
private int m_sizeCached size of filtered list.
-
-
Constructor Details
-
FilteredSegmentList
private FilteredSegmentList()Dummy default constructor for unmarshalling. -
FilteredSegmentList
public FilteredSegmentList(LazyList list, long match, FilteredSegmentList prior, OpenAttrBase owner) Constructor with everything specified.- Parameters:
list
- backing listmatch
- included element types maskprior
- filter which comes before this one (null
if none)owner
- element owning this list
-
FilteredSegmentList
Constructor with no prior filter.- Parameters:
list
- backing listmatch
- included element types maskowner
- element owning this list
-
-
Method Details
-
setModify
private void setModify()Update modify count to show cached state is current. This propagates to any prior filter(s). -
sync
private void sync()Synchronize filter to current list state. If the cached state is not current this updates the cached state to reflect the current state of the backing list. -
get
- Specified by:
get
in interfaceList
- Specified by:
get
in classAbstractList
-
size
public int size()- Specified by:
size
in interfaceCollection
- Specified by:
size
in interfaceList
- Specified by:
size
in classAbstractCollection
-
add
- Specified by:
add
in interfaceList
- Overrides:
add
in classAbstractList
-
remove
Removes the item at the index position.- Specified by:
remove
in interfaceList
- Overrides:
remove
in classAbstractList
- Parameters:
index
-- Returns:
- removed item
-
remove
- Specified by:
remove
in interfaceCollection
- Specified by:
remove
in interfaceList
- Overrides:
remove
in classAbstractCollection
-
set
- Specified by:
set
in interfaceList
- Overrides:
set
in classAbstractList
-
removeRange
protected void removeRange(int from, int to) - Overrides:
removeRange
in classAbstractList
-