E
- the linked list element type@StoreNotUseStandardSerialization @StorableClass public class LinkedListSupport<E> extends Object implements IListSupport<E>, Iterable<E>, ILinkedListSupportNodeManager<E>, Cloneable, Serializable
Constructor and Description |
---|
LinkedListSupport(IEqualsHashComparator comparator) |
LinkedListSupport(IInstanceFactory instanceFactory,
IEqualsHashComparator comparator) |
Modifier and Type | Method and Description |
---|---|
E |
add(int index,
E element)
add element at index position
|
E |
addAtBegin(E element) |
void |
addAtBegin(ILinkedListSupportNode<E> toAdd)
add node at begin of this list
package visibility, should be used only internally and by LinkedListSupportIterator |
E |
addAtEnd(E element)
add element at end of the list
|
void |
addAtEnd(LinkedListSupportNode<E> toAdd)
add node at end of this list
package visibility, should be used only internaly and by LinkedListSupportIterator |
void |
addBefore(ILinkedListSupportNode<E> reference,
ILinkedListSupportNode<E> toAdd)
add a node before reference node
|
E |
addReplace(E element)
add element at end of the list if equals element not already in the list,
else replace the equals element
|
void |
clear()
clear the list
|
LinkedListSupport |
clone() |
boolean |
contains(Object object)
to know if list contains an element equals to an object
equality check is done using Object.equals element implementation |
void |
decrementSize() |
ListIterator<E> |
descendingIterator()
Returns an iterator over the elements in this list in reverse sequential
order.
|
boolean |
equals(Object object) |
E |
get(int index) |
E |
get(Object object)
search for an element and return founded if one
|
IEqualsHashComparator |
getEqualsHashComparator() |
E |
getFirst()
get the first element of the list
null returned if empty list or if first element is null |
ILinkedListSupportNode<E> |
getFirstNode() |
E |
getLast()
get the last element of the list
null returned if empty list or if last element is null |
ILinkedListSupportNode<E> |
getLastNode()
get last node of the list, null for empty list
package visibility, should be used only by LinkedListSupportIterator |
int |
getModificationCount() |
ILinkedListSupportNode<E> |
getRoot()
get the root node, null for empty list
should be used only by LinkedListSupportIterator and
ILinkedListSupportNodeManager implementation |
int |
getSize() |
int |
hashCode() |
void |
incrementSize() |
int |
indexOf(Object object) |
boolean |
isEmpty() |
ListIterator<E> |
iterator()
next will return the first element if list not empty
no previous element |
ListIterator<E> |
iterator(int index)
next will return element at index position
|
int |
lastIndexOf(Object object) |
static LinkedListSupport |
newInstance(IInstanceFactory instanceFactory,
IEqualsHashComparator comparator) |
ILinkedListSupportNode<E> |
newLinkedListNode() |
void |
remove(ILinkedListSupportNode<E> toRemove)
remove a node from the list
must not change next and previous link in node to remove because this is used by LinkedListSupportIterator to restore its position in list |
E |
remove(int index)
remove element at index
|
E |
remove(Object object)
remove element
|
E |
removeFirst()
remove first element of the list
|
E |
removeLast()
remove last element of the list
|
void |
removeListener() |
void |
resetSize() |
E |
set(E element,
int index)
add element at position
|
void |
setLastNode(ILinkedListSupportNode<E> lastNode) |
void |
setListener(ISupportListener<E> listener) |
void |
setListManager(LinkedListSupportManager<E> listManager) |
void |
setRoot(ILinkedListSupportNode<E> rootNode) |
String |
toString() |
public LinkedListSupport(IEqualsHashComparator comparator)
public LinkedListSupport(IInstanceFactory instanceFactory, IEqualsHashComparator comparator)
public static LinkedListSupport newInstance(IInstanceFactory instanceFactory, IEqualsHashComparator comparator)
public int getModificationCount()
public void setListener(ISupportListener<E> listener)
setListener
in interface ISupportListenable<E>
public void removeListener()
removeListener
in interface ISupportListenable<E>
public IEqualsHashComparator getEqualsHashComparator()
getEqualsHashComparator
in interface ILinkedListSupportNodeManager<E>
public E addAtEnd(E element)
IListSupport
addAtEnd
in interface IListSupport<E>
element
- the element to addpublic void addAtEnd(LinkedListSupportNode<E> toAdd)
LinkedListSupportIterator
toAdd
- node to addpublic E addAtBegin(E element)
addAtBegin
in interface IListSupport<E>
element
- element to add at begin of listpublic void addAtBegin(ILinkedListSupportNode<E> toAdd)
LinkedListSupportIterator
toAdd
- node to addpublic void addBefore(ILinkedListSupportNode<E> reference, ILinkedListSupportNode<E> toAdd)
reference
- reference node for addtoAdd
- the node to addpublic E add(int index, E element)
IListSupport
add
in interface IListSupport<E>
index
- position for addelement
- element to addpublic E addReplace(E element)
IListSupport
addReplace
in interface IListSupport<E>
public E remove(Object object)
IListSupport
remove
in interface IListSupport<E>
object
- the element to removepublic E remove(int index)
IListSupport
remove
in interface IListSupport<E>
index
- position of element to removepublic E removeFirst()
IListSupport
removeFirst
in interface IListSupport<E>
public E removeLast()
IListSupport
removeLast
in interface IListSupport<E>
public void remove(ILinkedListSupportNode<E> toRemove)
LinkedListSupportIterator
to restore its position in listtoRemove
- the node to removepublic E getFirst()
IListSupport
getFirst
in interface IListSupport<E>
public E getLast()
IListSupport
getLast
in interface IListSupport<E>
public E get(Object object)
IListSupport
get
in interface IListSupport<E>
object
- the element to search forpublic E get(int index)
get
in interface IListSupport<E>
public E set(E element, int index)
IListSupport
set
in interface IListSupport<E>
public int indexOf(Object object)
indexOf
in interface IListSupport<E>
public int lastIndexOf(Object object)
lastIndexOf
in interface IListSupport<E>
public boolean contains(Object object)
IListSupport
Object.equals
element implementationcontains
in interface IListSupport<E>
object
- the element to search forpublic void clear()
IListSupport
clear
in interface IListSupport<E>
public int getSize()
getSize
in interface IListSupport<E>
getSize
in interface ILinkedListSupportNodeManager<E>
public boolean isEmpty()
isEmpty
in interface IListSupport<E>
public void incrementSize()
incrementSize
in interface ILinkedListSupportNodeManager<E>
public void decrementSize()
decrementSize
in interface ILinkedListSupportNodeManager<E>
public void resetSize()
resetSize
in interface ILinkedListSupportNodeManager<E>
public ListIterator<E> iterator()
IListSupport
public ListIterator<E> iterator(int index)
IListSupport
iterator
in interface IListSupport<E>
index
- start of the iterationpublic ListIterator<E> descendingIterator()
IListSupport
descendingIterator
in interface IListSupport<E>
public ILinkedListSupportNode<E> getRoot()
ILinkedListSupportNodeManager
LinkedListSupportIterator
and
ILinkedListSupportNodeManager
implementationgetRoot
in interface ILinkedListSupportNodeManager<E>
public void setRoot(ILinkedListSupportNode<E> rootNode)
setRoot
in interface ILinkedListSupportNodeManager<E>
public ILinkedListSupportNode<E> getLastNode()
ILinkedListSupportNodeManager
LinkedListSupportIterator
getLastNode
in interface ILinkedListSupportNodeManager<E>
public ILinkedListSupportNode<E> getFirstNode()
getFirstNode
in interface ILinkedListSupportNodeManager<E>
public void setLastNode(ILinkedListSupportNode<E> lastNode)
setLastNode
in interface ILinkedListSupportNodeManager<E>
public ILinkedListSupportNode<E> newLinkedListNode()
newLinkedListNode
in interface ILinkedListSupportNodeManager<E>
public LinkedListSupport clone()
public void setListManager(LinkedListSupportManager<E> listManager)
Copyright © 2007-2012 Luc Peuvrier. All Rights Reserved.