Top Description Fields Constructors Methods
org.dom4j.tree

public Class BackedList<T extends org.dom4j.Node>

extends ArrayList<T extends Node>
Class Inheritance
Imports
org.dom4j.Node, java.util.ArrayList, .Collection, .Iterator, .List

BackedList represents a list of content of a org.dom4j.Branch. Changes to the list will be reflected in the branch, though changes to the branch will not be reflected in this list.

Author
James Strachan
Version
$Revision: 1.14 $

Field Summary

Modifier and TypeField and Description
private AbstractBranch
branch

The AbstractBranch instance which owns the content

private List<Node>
branchContent

The content of the Branch which is modified if I am modified

Constructor Summary

AccessConstructor and Description
public
BackedList(AbstractBranch branch, List<Node> branchContent)

public
BackedList(AbstractBranch branch, List<Node> branchContent, int capacity)

public
BackedList(AbstractBranch branch, List<Node> branchContent, List<T> initialContent)

Method Summary

Modifier and TypeMethod and Description
public boolean
add(T
element to be appended to this list
node
)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Appends the specified element to the end of this list.
public void
add(int
index at which the specified element is to be inserted
index
,
T
element to be inserted
node
)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Inserts the specified element at the specified position in this list.
public boolean
addAll(Collection<? extends T>
collection containing elements to be added to this list
collection
)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll, java.util.Collection.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.
public boolean
addAll(int
index at which to insert the first element from the specified collection
index
,
Collection<? extends T>
collection containing elements to be added to this list
collection
)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll.

Inserts all of the elements in the specified collection into this list, starting at the specified position.
public void
addLocal(T
DOCUMENT ME!
node
)

Performs a local addition which is not forward through to the Branch or backing list

public void
clear()

Overrides java.util.ArrayList.clear.

Implements java.util.List.clear, java.util.Collection.clear.

Removes all of the elements from this list.
public boolean
remove(Object
element to be removed from this list, if present
object
)

Overrides java.util.ArrayList.remove.

Implements java.util.List.remove, java.util.Collection.remove.

Removes the first occurrence of the specified element from this list, if it is present.
public T
remove(int
the index of the element to be removed
index
)

Overrides java.util.ArrayList.remove.

Implements java.util.List.remove.

Removes the element at the specified position in this list.
public T
set(int
index of the element to replace
index
,
T
element to be stored at the specified position
node
)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element.
Inherited from java.util.ArrayList:
addFirstaddLastclonecontainsensureCapacityequalsforEachgetgetFirstgetLasthashCodeindexOfisEmptyiteratorlastIndexOflistIteratorlistIteratorremoveAllremoveFirstremoveIfremoveLastremoveRangereplaceAllretainAllsizesortspliteratorsubListtoArraytoArraytrimToSize

Field Detail

branchback to summary
private AbstractBranch branch

The AbstractBranch instance which owns the content

branchContentback to summary
private List<Node> branchContent

The content of the Branch which is modified if I am modified

Constructor Detail

BackedListback to summary
public BackedList(AbstractBranch branch, List<Node> branchContent)
BackedListback to summary
public BackedList(AbstractBranch branch, List<Node> branchContent, int capacity)
BackedListback to summary
public BackedList(AbstractBranch branch, List<Node> branchContent, List<T> initialContent)

Method Detail

addback to summary
public boolean add(T node)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Doc from java.util.ArrayList.add.

Appends the specified element to the end of this list.

Parameters
node:T

element to be appended to this list

Returns:boolean

true (as specified by Collection#add)

Annotations
@Override
addback to summary
public void add(int index, T node)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Doc from java.util.ArrayList.add.

Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Parameters
index:int

index at which the specified element is to be inserted

node:T

element to be inserted

Annotations
@Override
addAllback to summary
public boolean addAll(Collection<? extends T> collection)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll, java.util.Collection.addAll.

Doc from java.util.ArrayList.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this list, and this list is nonempty.)

Parameters
collection:Collection<? extends T>

collection containing elements to be added to this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Override
addAllback to summary
public boolean addAll(int index, Collection<? extends T> collection)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll.

Doc from java.util.ArrayList.addAll.

Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.

Parameters
index:int

index at which to insert the first element from the specified collection

collection:Collection<? extends T>

collection containing elements to be added to this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Override
addLocalback to summary
public void addLocal(T node)

Performs a local addition which is not forward through to the Branch or backing list

Parameters
node:T

DOCUMENT ME!

clearback to summary
public void clear()

Overrides java.util.ArrayList.clear.

Implements java.util.List.clear, java.util.Collection.clear.

Doc from java.util.ArrayList.clear.

Removes all of the elements from this list. The list will be empty after this call returns.

Annotations
@Override
removeback to summary
public boolean remove(Object object)

Overrides java.util.ArrayList.remove.

Implements java.util.List.remove, java.util.Collection.remove.

Doc from java.util.ArrayList.remove.

Removes the first occurrence of the specified element from this list, if it is present. If the list does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that Objects.equals(o, get(i)) (if such an element exists). Returns true if this list contained the specified element (or equivalently, if this list changed as a result of the call).

Parameters
object:Object

element to be removed from this list, if present

Returns:boolean

true if this list contained the specified element

Annotations
@Override
removeback to summary
public T remove(int index)

Overrides java.util.ArrayList.remove.

Implements java.util.List.remove.

Doc from java.util.ArrayList.remove.

Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).

Parameters
index:int

the index of the element to be removed

Returns:T

the element that was removed from the list

Annotations
@Override
setback to summary
public T set(int index, T node)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Doc from java.util.ArrayList.set.

Replaces the element at the specified position in this list with the specified element.

Parameters
index:int

index of the element to replace

node:T

element to be stored at the specified position

Returns:T

the element previously at the specified position

Annotations
@Override