Package jade.content
Class ContentElementList
- java.lang.Object
-
- jade.content.ContentElementList
-
- All Implemented Interfaces:
ContentElement,Serializable,Serializable
public class ContentElementList extends Object implements ContentElement
Utility class to deal with a list of content elements as a content element itself.- Author:
- Federico Bergenti - Universita` di Parma
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ContentElementList()Construct a ContentElementList object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ContentElement element)Adds a new element (that must be a content element) to this content element list.voidclear()Clear all the elements in this content element list.booleancontains(ContentElement element)Test if a given content element is contained in this content element list.ContentElementget(int i)Retrieves thei-th element in this content element list.intindexOf(ContentElement element)Returns the position of an element within this content element list.booleanisEmpty()Test if the content element list is empty.Iteratoriterator()ContentElementremove(int index)Removes the element at the given position from this content element list.intsize()Retrieves the number of elements in this content element list.ContentElement[]toArray()Retrieve all elements in this content element list in the form of an array.
-
-
-
Method Detail
-
add
public void add(ContentElement element)
Adds a new element (that must be a content element) to this content element list.- Parameters:
element- The element to add.
-
size
public int size()
Retrieves the number of elements in this content element list.- Returns:
- The number of elements.
-
get
public ContentElement get(int i)
Retrieves thei-th element in this content element list.- Parameters:
i- The index of the element to retrieve.- Returns:
- The element.
-
iterator
public Iterator iterator()
- Returns:
- An
Iteratorover the elements of this content element list.
-
clear
public void clear()
Clear all the elements in this content element list.
-
contains
public boolean contains(ContentElement element)
Test if a given content element is contained in this content element list.- Returns:
trueif the given content element is contained in this content element list.
-
indexOf
public int indexOf(ContentElement element)
Returns the position of an element within this content element list.- Returns:
- The position of an element within this content element list or -1 if the given element is not contained in this content element list.
-
remove
public ContentElement remove(int index)
Removes the element at the given position from this content element list.- Returns:
- The removed element.
-
isEmpty
public boolean isEmpty()
Test if the content element list is empty.- Returns:
trueif this content element list does not contain any element.
-
toArray
public ContentElement[] toArray()
Retrieve all elements in this content element list in the form of an array.- Returns:
- An array containing all elements in this content element list.
-
-