Package org.oddjob.structural
Interface ChildList<E>
- Type Parameters:
E- The type of the child.
- All Known Implementing Classes:
ChildHelper
public interface ChildList<E>
A modifiable list of children.
- Author:
- rob
-
Method Summary
Modifier and TypeMethodDescriptionintAdd a child to the end of the list.voidinsertChild(int index, E child) Insert a child.intremoveChild(E child) Remove a child.removeChildAt(int index) Remove a child by index.
-
Method Details
-
insertChild
Insert a child.- Parameters:
index- The 0 based index of the insert.child- The child. Must not be null.
-
addChild
Add a child to the end of the list.- Parameters:
child- The child. Must not be null.- Returns:
- The index the child was added at.
-
removeChildAt
Remove a child by index.- Parameters:
index- The index of the child to remove.- Returns:
- The child removed.
- Throws:
IndexOutOfBoundsException- If there is no child at the index.
-
removeChild
Remove a child.- Parameters:
child- The child to be removed.- Returns:
- The index the child was removed from.
- Throws:
IllegalStateException- If the child is not a child of this list.
-