Class PositionListBase<T, P extends IPositionHolder<T,P>>
java.lang.Object
com.vladsch.flexmark.experimental.util.collection.iteration.PositionListBase<T,P>
- Type Parameters:
T- type of positionP- type of position holder
- All Implemented Interfaces:
IPositionListener, IPositionUpdater<T,P>, IPreviewPositionListener, Iterable<P>
- Direct Known Subclasses:
PositionList
public abstract class PositionListBase<T, P extends IPositionHolder<T,P>>
extends Object
implements Iterable<P>, IPositionUpdater<T,P>
Iterator for list positions allowing to iterate over current elements while inserting and deleting elements relative to current position
elements inserted at current position or at current + 1 position will skipped in the iteration allowing adding new elements which will not be part of the iteration
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NotNull PositionFactory<T, P> private final @NotNull Stack<PositionListBase.FrameLevel> private intprivate final @NotNull WeakHashMap<IPositionListener, Integer> private intprivate @Nullable WeakHashMap<IPreviewPositionListener, Boolean> -
Constructor Summary
ConstructorsConstructorDescriptionPositionListBase(@NotNull List<T> list, @NotNull PositionFactory<T, P> factory) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanbooleanaddAll(int index, @NotNull PositionListBase<T, P> other) booleanaddAll(int index, @NotNull Collection<? extends T> elements) booleanaddAll(@NotNull PositionListBase<T, P> other) booleanaddAll(@NotNull Collection<? extends T> elements) voidaddPositionListener(@NotNull IPositionListener listener) Add list edit listener for notifications of mods to the listvoidAfter set NotificationBefore set Notificationvoidclear()voidcloseFrame(Object frameId) voiddeleted(int index, int count) delete Notificationvoiddeleting(int index, int count) before delete Notificationbooleanget(int index) getEnd()getFirst()getLast()getList()int@NotNull StringintgetOrNull(int index) <S extends T>
SgetPosition(int index, @NotNull PositionAnchor anchor) intinthashCode()voidinserted(int index, int count) insert NotificationbooleanisEmpty()booleaniterator()remove(int index) voidremove(int startIndex, int endIndex) voidremovePositionListener(@NotNull IPositionListener listener) Remove list edit listenerreversed()intsize()private voidthrowIllegalStateWithOpenFrameTrace(@Nullable StringBuilder out, PositionListBase.FrameLevel frame) voidMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IPositionUpdater
getPositionMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
myList
-
myListeners
-
myPreviewListeners
-
myFactory
-
myFrames
-
myLastFrameId
private int myLastFrameId -
myMaxListeners
private int myMaxListeners
-
-
Constructor Details
-
PositionListBase
public PositionListBase(@NotNull @NotNull List<T> list, @NotNull @NotNull PositionFactory<T, P> factory)
-
-
Method Details
-
getListeners
@TestOnly public int getListeners() -
getMaxListeners
@TestOnly public int getMaxListeners() -
getPreviewListeners
@TestOnly public int getPreviewListeners() -
addPositionListener
Add list edit listener for notifications of mods to the list- Specified by:
addPositionListenerin interfaceIPositionUpdater<T, P extends IPositionHolder<T,P>> - Parameters:
listener- listener
-
removePositionListener
Remove list edit listenerNOTE: removal is optional. Only weak refs are kept for the listener
- Specified by:
removePositionListenerin interfaceIPositionUpdater<T, P extends IPositionHolder<T,P>> - Parameters:
listener- listener
-
iterator
-
reversedIterator
-
reversed
-
iterator
- Specified by:
iteratorin interfaceIPositionUpdater<T, P extends IPositionHolder<T,P>>
-
getList
- Specified by:
getListin interfaceIPositionUpdater<T, P extends IPositionHolder<T,P>>
-
isEmpty
public boolean isEmpty() -
isNotEmpty
public boolean isNotEmpty() -
get
-
getOrNull
-
getOrNull
-
openFrame
-
getListParentId
-
closeFrame
-
throwIllegalStateWithOpenFrameTrace
private void throwIllegalStateWithOpenFrameTrace(@Nullable @Nullable StringBuilder out, PositionListBase.FrameLevel frame) -
getPosition
- Specified by:
getPositionin interfaceIPositionUpdater<T, P extends IPositionHolder<T,P>>
-
unframe
- Specified by:
unframein interfaceIPositionUpdater<T, P extends IPositionHolder<T,P>>
-
getFirst
-
getLast
-
getEnd
-
clear
public void clear()- Specified by:
clearin interfaceIPositionUpdater<T, P extends IPositionHolder<T,P>>
-
inserted
public void inserted(int index, int count) Description copied from interface:IPositionListenerinsert Notification- Specified by:
insertedin interfaceIPositionListener- Parameters:
index- at which insert was performed, list contents and size at this point are already updatedcount- of elements inserted
-
deleted
public void deleted(int index, int count) Description copied from interface:IPositionListenerdelete Notification- Specified by:
deletedin interfaceIPositionListener- Parameters:
index- at which delete was performed, list contents and size at this point are already updatedcount- of elements deleted
-
deleting
public void deleting(int index, int count) Description copied from interface:IPreviewPositionListenerbefore delete Notification- Specified by:
deletingin interfaceIPreviewPositionListener- Parameters:
index- at which delete will be performed, list contents and size at this point have not changedcount- of elements deleted
-
changing
Description copied from interface:IPreviewPositionListenerBefore set NotificationNOTE: the returned class should be the same or a subclass of original object's class
- Specified by:
changingin interfaceIPreviewPositionListener- Parameters:
index- at which set is being performed, list contents and size at this point are not updatedvalue- new value for the element- Returns:
- value to use for setting the element
-
changed
Description copied from interface:IPreviewPositionListenerAfter set NotificationNOTE: the returned class should be the same or a subclass of original object's class
- Specified by:
changedin interfaceIPreviewPositionListener- Parameters:
index- at which set is being performed, list contents and size at this point are already updatedoldValue- value at index before settingnewValue- value at index before setting
-
set
-
remove
-
remove
public void remove(int startIndex, int endIndex) -
add
-
add
-
addAll
-
addAll
-
addAll
-
addAll
-
size
public int size() -
equals
-
hashCode
-