Blackjack

com.amoebacode.blackjack.core
Class GameObject

java.lang.Object
  |
  +--com.amoebacode.blackjack.core.GameObject
All Implemented Interfaces:
IGameObject
Direct Known Subclasses:
CardCollection, Game, Participant, Round

abstract class GameObject
extends java.lang.Object
implements IGameObject

GameObject is the base class for the core game classes, managing the parent object and event listener collection.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  EventListenerCollection listeners
          The collection of event listeners for this game object
private  IGameObject parent
          The parent for this game object
 
Constructor Summary
protected GameObject()
          Protected constructor used by the top level game object.
protected GameObject(IGameObject parent)
          Default protected constructor.
 
Method Summary
 void addEventListener(BlackjackEventListener listener)
          Adds the specified event listener to this object's event listener collection.
protected  EventListenerCollection getEventListenerCollection()
          Returns the event listener collection for this object.
 IGame getGame()
          Returns the top level game object.
 IGameObject getParent()
          Returns the parent of this game object.
protected  boolean hasParent()
          Indicates whether this object has a parent object (true for all objects except the top-level game object).
protected  void setEventListenerCollection(EventListenerCollection listeners)
          Sets the event listener collection for this object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

parent

private IGameObject parent
The parent for this game object

listeners

private EventListenerCollection listeners
The collection of event listeners for this game object
Constructor Detail

GameObject

protected GameObject(IGameObject parent)
Default protected constructor.
Parameters:
parent - the IGameObject parent of this object

GameObject

protected GameObject()
Protected constructor used by the top level game object.
Method Detail

getParent

public IGameObject getParent()
Description copied from interface: IGameObject
Returns the parent of this game object.
Specified by:
getParent in interface IGameObject
See Also:
IGameObject.getParent()

hasParent

protected boolean hasParent()
Indicates whether this object has a parent object (true for all objects except the top-level game object).
Returns:
true if this object has a parent

getGame

public IGame getGame()
Description copied from interface: IGameObject
Returns the top level game object.
Specified by:
getGame in interface IGameObject
See Also:
IGameObject.getGame()

setEventListenerCollection

protected void setEventListenerCollection(EventListenerCollection listeners)
Sets the event listener collection for this object.
Parameters:
listeners - this object's new EventListenerCollection

getEventListenerCollection

protected EventListenerCollection getEventListenerCollection()
Returns the event listener collection for this object.
Returns:
this object's EventListenerCollection

addEventListener

public void addEventListener(BlackjackEventListener listener)
Description copied from interface: IGameObject
Adds the specified event listener to this object's event listener collection.
Specified by:
addEventListener in interface IGameObject
See Also:
IGameObject.addEventListener(BlackjackEventListener)

Blackjack

Copyright © 2002 amoebacode.com.