public class ChildHelper<E> extends Object implements Structural, Iterable<E>, ChildList<E>
Constructor and Description |
---|
ChildHelper(Structural source)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
addChild(E child)
Add a child to the end of the list.
|
void |
addStructuralListener(StructuralListener listener)
Add a listener.
|
boolean |
contains(E child)
Is this child ours?
|
E |
getChild()
Return an only child.
|
E |
getChildAt(int index)
Return a child.
|
Object[] |
getChildren()
Return an array of children.
|
E[] |
getChildren(E[] array)
Return an array of children.
|
static Object[] |
getChildren(Structural structural) |
void |
hardResetChildren()
Perform a hard reset.
|
void |
insertChild(int index,
E child)
Insert a child.
|
boolean |
isNoListeners()
Returns true if there are no listeners listening for
StructuralEvent s. |
Iterator<E> |
iterator() |
void |
removeAllChildren()
Allows a sub class to remove all children from itself.
|
int |
removeChild(Object child)
Remove a child.
|
E |
removeChildAt(int index)
Remove a child by index.
|
void |
removeStructuralListener(StructuralListener listener)
Remove a listener.
|
int |
size()
The number of children.
|
void |
softResetChildren()
Perform a soft reset.
|
void |
stopChildren()
Stops all the child jobs.
|
String |
toString() |
public ChildHelper(Structural source)
source
- The source used as the source of the event.public void insertChild(int index, E child)
insertChild
in interface ChildList<E>
index
- The index.child
- The child.public int addChild(E child)
public E removeChildAt(int index) throws IndexOutOfBoundsException
removeChildAt
in interface ChildList<E>
index
- The index of the child to remove.IndexOutOfBoundsException
- If there is no child at the index.public int removeChild(Object child) throws IllegalStateException
removeChild
in interface ChildList<E>
child
- The child to be removed.IllegalStateException
- If the child is not our child.public void removeAllChildren()
This method isn't synchronized. Simultaneous removal of children by a different thread could result in an IndexOutOfBoundsException.
public void stopChildren() throws FailedToStopException
FailedToStopException
public void softResetChildren()
public void hardResetChildren()
public Object[] getChildren()
public E[] getChildren(E[] array)
public E getChildAt(int index)
public E getChild()
public boolean contains(E child)
child
- public void addStructuralListener(StructuralListener listener)
Structural
addStructuralListener
in interface Structural
listener
- The listener.public void removeStructuralListener(StructuralListener listener)
Structural
removeStructuralListener
in interface Structural
listener
- The listener.public boolean isNoListeners()
StructuralEvent
s.public int size()
public static Object[] getChildren(Structural structural)