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
,java.lang.Iterable<P>
- Direct Known Subclasses:
PositionList
public abstract class PositionListBase<T,P extends IPositionHolder<T,P>> extends java.lang.Object implements java.lang.Iterable<P>, IPositionUpdater<T,P>
Iterator for list positions allowing to iterate over current elements while inserting and deleting elements relative to current positionelements 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
-
-
Constructor Summary
Constructors Constructor Description PositionListBase(java.util.List<T> list, PositionFactory<T,P> factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(int index, T element)
boolean
add(T element)
boolean
addAll(int index, PositionListBase<T,P> other)
boolean
addAll(int index, java.util.Collection<? extends T> elements)
boolean
addAll(PositionListBase<T,P> other)
boolean
addAll(java.util.Collection<? extends T> elements)
void
addPositionListener(IPositionListener listener)
Add list edit listener for notifications of mods to the listvoid
changed(int index, java.lang.Object oldValue, java.lang.Object newValue)
After set Notificationjava.lang.Object
changing(int index, java.lang.Object value)
Before set Notificationvoid
clear()
void
closeFrame(java.lang.Object frameId)
void
deleted(int index, int count)
delete Notificationvoid
deleting(int index, int count)
before delete Notificationboolean
equals(java.lang.Object o)
T
get(int index)
P
getEnd()
P
getFirst()
P
getLast()
java.util.List<T>
getList()
int
getListeners()
java.lang.String
getListParentId()
int
getMaxListeners()
T
getOrNull(int index)
<S extends T>
SgetOrNull(int index, java.lang.Class<S> elementClass)
P
getPosition(int index, PositionAnchor anchor)
int
getPreviewListeners()
int
hashCode()
void
inserted(int index, int count)
insert Notificationboolean
isEmpty()
boolean
isNotEmpty()
java.util.Iterator<P>
iterator()
java.util.Iterator<P>
iterator(P position)
java.lang.Object
openFrame()
T
remove(int index)
void
remove(int startIndex, int endIndex)
void
removePositionListener(IPositionListener listener)
Remove list edit listenerjava.lang.Iterable<P>
reversed()
java.util.Iterator<P>
reversedIterator()
T
set(int index, T value)
int
size()
void
unframe(P position)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vladsch.flexmark.experimental.util.collection.iteration.IPositionUpdater
getPosition
-
-
-
-
Constructor Detail
-
PositionListBase
public PositionListBase(@NotNull java.util.List<T> list, @NotNull PositionFactory<T,P> factory)
-
-
Method Detail
-
getListeners
@TestOnly public int getListeners()
-
getMaxListeners
@TestOnly public int getMaxListeners()
-
getPreviewListeners
@TestOnly public int getPreviewListeners()
-
addPositionListener
public void addPositionListener(@NotNull IPositionListener listener)
Add list edit listener for notifications of mods to the list- Specified by:
addPositionListener
in interfaceIPositionUpdater<T,P extends IPositionHolder<T,P>>
- Parameters:
listener
- listener
-
removePositionListener
public void removePositionListener(@NotNull IPositionListener listener)
Remove list edit listenerNOTE: removal is optional. Only weak refs are kept for the listener
- Specified by:
removePositionListener
in interfaceIPositionUpdater<T,P extends IPositionHolder<T,P>>
- Parameters:
listener
- listener
-
iterator
@NotNull public java.util.Iterator<P> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
-
reversedIterator
@NotNull public java.util.Iterator<P> reversedIterator()
-
reversed
@NotNull public java.lang.Iterable<P> reversed()
-
iterator
@NotNull public java.util.Iterator<P> iterator(@NotNull P position)
- Specified by:
iterator
in interfaceIPositionUpdater<T,P extends IPositionHolder<T,P>>
-
getList
@NotNull public java.util.List<T> getList()
- Specified by:
getList
in interfaceIPositionUpdater<T,P extends IPositionHolder<T,P>>
-
isEmpty
public boolean isEmpty()
-
isNotEmpty
public boolean isNotEmpty()
-
get
public T get(int index)
-
getOrNull
public T getOrNull(int index)
-
getOrNull
public <S extends T> S getOrNull(int index, java.lang.Class<S> elementClass)
-
openFrame
public java.lang.Object openFrame()
-
getListParentId
@NotNull public java.lang.String getListParentId()
-
closeFrame
public void closeFrame(java.lang.Object frameId)
-
getPosition
public P getPosition(int index, @NotNull PositionAnchor anchor)
- Specified by:
getPosition
in interfaceIPositionUpdater<T,P extends IPositionHolder<T,P>>
-
unframe
public void unframe(P position)
- Specified by:
unframe
in interfaceIPositionUpdater<T,P extends IPositionHolder<T,P>>
-
getFirst
public P getFirst()
-
getLast
public P getLast()
-
getEnd
public P getEnd()
-
clear
public void clear()
- Specified by:
clear
in interfaceIPositionUpdater<T,P extends IPositionHolder<T,P>>
-
inserted
public void inserted(int index, int count)
Description copied from interface:IPositionListener
insert Notification- Specified by:
inserted
in 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:IPositionListener
delete Notification- Specified by:
deleted
in 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:IPreviewPositionListener
before delete Notification- Specified by:
deleting
in interfaceIPreviewPositionListener
- Parameters:
index
- at which delete will be performed, list contents and size at this point have not changedcount
- of elements deleted
-
changing
public java.lang.Object changing(int index, java.lang.Object value)
Description copied from interface:IPreviewPositionListener
Before set NotificationNOTE: the returned class should be the same or a subclass of original object's class
- Specified by:
changing
in 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
public void changed(int index, java.lang.Object oldValue, java.lang.Object newValue)
Description copied from interface:IPreviewPositionListener
After set NotificationNOTE: the returned class should be the same or a subclass of original object's class
- Specified by:
changed
in 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
-
remove
public T remove(int index)
-
remove
public void remove(int startIndex, int endIndex)
-
add
public boolean add(T element)
-
add
public boolean add(int index, T element)
-
addAll
public boolean addAll(@NotNull PositionListBase<T,P> other)
-
addAll
public boolean addAll(int index, @NotNull PositionListBase<T,P> other)
-
addAll
public boolean addAll(@NotNull java.util.Collection<? extends T> elements)
-
addAll
public boolean addAll(int index, @NotNull java.util.Collection<? extends T> elements)
-
size
public int size()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-