public class ChildHelper<E> extends java.lang.Object implements Structural, java.lang.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.
|
java.lang.Object[] |
getChildren()
Return an array of children.
|
E[] |
getChildren(E[] array)
Return an array of children.
|
static java.lang.Object[] |
getChildren(Structural structural) |
void |
hardResetChildren()
Perform a hard reset.
|
void |
insertChild(int index,
E child)
Insert a child.
|
void |
insertOrRemoveChild(int index,
E child)
Insert or remove a child depending on if the child is null.
|
boolean |
isNoListeners()
Returns true if there are no listeners listening for
StructuralEvent s. |
java.util.Iterator<E> |
iterator() |
void |
removeAllChildren()
Allows a sub class to remove all children from itself.
|
int |
removeChild(java.lang.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.
|
java.lang.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 java.lang.IndexOutOfBoundsException
removeChildAt
in interface ChildList<E>
index
- The index of the child to remove.java.lang.IndexOutOfBoundsException
- If there is no child at the index.public void insertOrRemoveChild(int index, E child)
index
- The index.child
- The child.public int removeChild(java.lang.Object child) throws java.lang.IllegalStateException
removeChild
in interface ChildList<E>
child
- The child to be removed.java.lang.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 java.lang.Object[] getChildren()
public E[] getChildren(E[] array)
public E getChildAt(int index)
public E getChild()
public boolean contains(E child)
child
- public java.util.Iterator<E> iterator()
iterator
in interface java.lang.Iterable<E>
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 java.lang.Object[] getChildren(Structural structural)
public java.lang.String toString()
toString
in class java.lang.Object