nankin.zheng.gatem.model
Class GameEvent

java.lang.Object
  |
  +--nankin.zheng.gatem.model.GameEvent

public class GameEvent
extends java.lang.Object

GameEvent works as the medium of the communication among different roles.

It is a read-only bean. It can be extended by a certain game to provide more complex event.


Field Summary
private  AttributeSet attributeSet
           
private  GameContainer container
           
private static int createdInstanceCount
           
private static int finalizedInstanceCount
           
private  int id
           
private  Role source
           
 
Constructor Summary
GameEvent(int eid, GameContainer gcont, Role src)
          Constructor with a minimun parameter list.
GameEvent(int eid, GameContainer gcont, Role src, AttributeSet attrs)
          Constructor with a complete parameter list.
 
Method Summary
 AttributeSet getAttributeSet()
          Get source role attribute set.
 GameContainer getContainer()
          Get source game container.
static int getCreatedInstanceCount()
           
static int getFinalizedInstanceCount()
           
 int getId()
          Get event id.
 Role getSource()
          Get source role object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

createdInstanceCount

private static int createdInstanceCount

finalizedInstanceCount

private static int finalizedInstanceCount

id

private int id

container

private GameContainer container

source

private Role source

attributeSet

private AttributeSet attributeSet
Constructor Detail

GameEvent

public GameEvent(int eid,
                 GameContainer gcont,
                 Role src)
Constructor with a minimun parameter list.

Parameters:
eid - event id, which is defined in a game-dependent environment.
gcont - game container where this event is fired.
src - source role who fires this event.
Throws:
java.lang.NullPointerException - if gcont or src is null.

GameEvent

public GameEvent(int eid,
                 GameContainer gcont,
                 Role src,
                 AttributeSet attrs)
Constructor with a complete parameter list.

Parameters:
eid - event id
gcont - game container
src - source role
attrs - attributes of source role
Throws:
java.lang.NullPointerException - if gcont, src or attrs is null.
Method Detail

getCreatedInstanceCount

public static int getCreatedInstanceCount()

getFinalizedInstanceCount

public static int getFinalizedInstanceCount()

getId

public int getId()
Get event id.

Returns:
event id

getSource

public Role getSource()
Get source role object.

Returns:
source role object

getContainer

public GameContainer getContainer()
Get source game container.

Returns:
source game container.

getAttributeSet

public AttributeSet getAttributeSet()
Get source role attribute set.

Returns:
source role attribute set.