public class BeadArray extends Bead
Bead.kill()
, Bead.start()
and Bead.pause(boolean)
messages to its component Beads unless told to do so by setting setForwardKillCommand(boolean)
and setForwardPauseCommand(boolean)
respectively.Constructor and Description |
---|
BeadArray()
Creates an empty BeadArray.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Bead bead)
Adds a new Bead to the list of receivers.
|
void |
clear()
Clears the list of receivers.
|
BeadArray |
clone()
Creates a shallow copy of itself.
|
boolean |
doesForwardKillCommand()
Checks if this BeadArray forwards kill commands.
|
boolean |
doesForwardPauseCommand()
Checks if this BeadArray forwards pause commands.
|
Bead |
get(int i)
Gets the ith Bead from the list of receivers.
|
java.util.ArrayList<Bead> |
getBeads()
Gets the contents of this BeadArrays as an ArrayList of Beads.
|
void |
kill()
Stops this Bead, and flags it as deleted.
|
void |
messageReceived(Bead message)
Forwards incoming message to all receivers.
|
void |
pause(boolean paused)
Toggle the paused state of the Bead.
|
void |
remove(Bead bead)
Removes a Bead from the list of receivers.
|
void |
setForwardKillCommand(boolean forwardKillCommand)
Determines whether or not this BeadArray forwards kill commands.
|
void |
setForwardPauseCommand(boolean forwardPauseCommand)
Determines whether or not this BeadArray forwards pause commands.
|
int |
size()
Gets the size of the list of receivers.
|
void |
start()
Shortcut for pause(false).
|
getKillListener, getName, isDeleted, isPaused, message, setKillListener, setName, toString
public void add(Bead bead)
bead
- Bead to add.public void remove(Bead bead)
bead
- Bead to remove.public Bead get(int i)
i
- index of Bead to retrieve.public void clear()
public int size()
public java.util.ArrayList<Bead> getBeads()
public void messageReceived(Bead message)
messageReceived
in class Bead
message
- incoming message.public BeadArray clone()
clone
in class java.lang.Object
public boolean doesForwardKillCommand()
public void setForwardKillCommand(boolean forwardKillCommand)
forwardKillCommand
- true if this BeadArray forwards kill commands.public boolean doesForwardPauseCommand()
public void setForwardPauseCommand(boolean forwardPauseCommand)
forwardPauseCommand
- true if this BeadArray forwards pause commands.public void kill()
Bead
BeadArray
s. Calling this method for the first time
also causes the killListener to be notified.public void pause(boolean paused)
Bead