Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.meowers.cide.data
Class GameData  view GameData download GameData.java

java.lang.Object
  extended byorg.meowers.cide.data.GameObject
      extended byorg.meowers.cide.data.GameData
All Implemented Interfaces:
java.io.Serializable

public class GameData
extends GameObject

Stores all the data necessary for a game to be run, or at least provides wrappers to other storage classes.

Version:
%I%, %G%

Field Summary
private  java.util.ArrayList[] stores
           
private  int tileSize
           
 
Fields inherited from class org.meowers.cide.data.GameObject
dirty, GAME_DATA, MAP, MAX_TYPE, name, TILE, TILE_SET, type
 
Constructor Summary
GameData()
          Creates new GameData.
 
Method Summary
 void addGameObject(GameObject gameObj)
          Adds and GameObject object to store in the game data.
 GameObject getGameObject(int objType, int index)
          Gets a GameObject at a specified index of a specified type.
 int getGameObjectCount(int objType)
          Returns the number of GameObjects of the specified type are stored here.
 int getTileSize()
          Returns the size of tiles used in this game.
private  boolean isArrayDirty(java.util.ArrayList list)
          Checks all the elements of an array of objects, and for each one of class GameObject it checks if its dirty.
 boolean isDirty()
          Returns the dirty state of this game data.
private  boolean isGameObjectTypeValid(int objType)
          Checks to see if the type of object is one that is storable here.
 boolean setTileSize(int tileSize, boolean destroy)
          Set the size of tiles used in this game.
 
Methods inherited from class org.meowers.cide.data.GameObject
getName, getType, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

stores

private java.util.ArrayList[] stores

tileSize

private int tileSize
Constructor Detail

GameData

public GameData()
Creates new GameData.

Method Detail

isGameObjectTypeValid

private boolean isGameObjectTypeValid(int objType)
Checks to see if the type of object is one that is storable here. In particular, it must be a valid type and not a GameData type either.


addGameObject

public void addGameObject(GameObject gameObj)
Adds and GameObject object to store in the game data.


getGameObjectCount

public int getGameObjectCount(int objType)
Returns the number of GameObjects of the specified type are stored here. The the type specified is not valid, returns zero.


getGameObject

public GameObject getGameObject(int objType,
                                int index)
Gets a GameObject at a specified index of a specified type. Returns null if something went wrong.


isArrayDirty

private boolean isArrayDirty(java.util.ArrayList list)
Checks all the elements of an array of objects, and for each one of class GameObject it checks if its dirty. Returns true if any of the array's GameObject type elements are dirty.


isDirty

public boolean isDirty()
Returns the dirty state of this game data. This also does a deep check of all contained data objects.

Overrides:
isDirty in class GameObject

getTileSize

public int getTileSize()
Returns the size of tiles used in this game.


setTileSize

public boolean setTileSize(int tileSize,
                           boolean destroy)
Set the size of tiles used in this game. If tiles exist, the operation fails unless the destroy parameter is true, in which case the existing tiles are discarded. NOTE: Soon a method of changing the tile size non-destructivley should be provided for maximum editing ability.