|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.beadsproject.beads.core.Bead
net.beadsproject.beads.core.BeadArray
public class BeadArray
BeadArray represents an array of Beads (and is itself a subclass of Bead). Its purpose is to forward messages to its array members. A BeadArray detects whether or not its members are deleted, and removes them if they are. For this reason it should be used in any situations where a Bead needs to be automatically disposed of. Note, however, that a BeadArray does not forward 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 Summary | |
---|---|
BeadArray()
Creates an empty BeadArray. |
Method Summary | |
---|---|
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). |
Methods inherited from class net.beadsproject.beads.core.Bead |
---|
getKillListener, getName, isDeleted, isPaused, message, setKillListener, setName, toString |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BeadArray()
Method Detail |
---|
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.
kill
in class Bead
public void pause(boolean paused)
Bead
pause
in class Bead
paused
- true to pause Bead.public void start()
Bead
start
in class Bead
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |