|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.jinx.action.Actor
public abstract class Actor
Actor serves as the abstract base class of anything that has a presence of
any kind in a Scene. An actor may be visible, audible, or even something
non-sensory that has influence on the Scene or other Actors in it.
The primary funcionality of this class is to send and receive events.
All Actors must have an owner to do this. The owner is a Scene object and is
used to pass events between Actors.
API Stability: Beta.
Constructor Summary | |
---|---|
Actor(java.lang.String name)
Constructs an Actor. |
Method Summary | |
---|---|
protected void |
checkAllowAdd(Scene scene)
Provides a way for an Actor to determine if it can be added to a particular Scene. |
java.lang.String |
getName()
Provides the name of this Actor. |
Scene |
getOwner()
Provides the Scene that owns this Actor. |
int |
hashCode()
|
protected void |
ownerChanged(Scene owner)
This method does nothing, but is called when this Actor is added to a Scene. |
protected abstract void |
processEvent(ActorEvent event)
Processes an ActorEvent. |
protected void |
sendEvent(Actor target,
ActorEvent event)
Sends an ActorEvent directly to the target Actor. |
protected void |
sendEvent(java.util.Collection targets,
ActorEvent event)
Sends an ActorEvent to as many of the targets in the Collection as possible. |
protected void |
sendEvent(java.lang.String target,
ActorEvent event)
Sends an ActorEvent to the target in this Actor's Scene. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Actor(java.lang.String name)
name
- the name that this Actor will be known by. This cannot be
null.Method Detail |
---|
public final java.lang.String getName()
public int hashCode()
hashCode
in class java.lang.Object
protected void checkAllowAdd(Scene scene)
java.lang.IllegalArgumentException
- if adding this Actor to scene is not
acceptable.protected void ownerChanged(Scene owner)
public final Scene getOwner()
protected void sendEvent(java.lang.String target, ActorEvent event)
target
- the name of the Actor to send the event to. If this is "*"
it means the message sgould be delivered to all Actors in the Scene.event
- the ActorEvent to send. This will be source stamped before
it is sent.
java.lang.NullPointerException
- if this Actor has no owner.protected void sendEvent(Actor target, ActorEvent event)
target
- the Actor to send the event to.event
- the ActorEvent to send. This will be source stamped before
it is sent.protected void sendEvent(java.util.Collection targets, ActorEvent event)
targets
- a java.util.Collection containing String and Actor
objects. Anything in it that isn't one of those is ignored.event
- the ActorEvent to send. This will be source stamped before
it is sent.protected abstract void processEvent(ActorEvent event)
event
- the ActorEvent to process.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |