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

Quick Search    Search Deep

org.metacosm.framework.entity
Class IdServer  view IdServer download IdServer.java

java.lang.Object
  extended byorg.metacosm.framework.entity.IdServer
All Implemented Interfaces:
org.metacosm.framework.persistence.Persistent, java.io.Serializable

public final class IdServer
extends java.lang.Object
implements org.metacosm.framework.persistence.Persistent

This class allocates Ids for Actions, Controllers and Entities. It doesn't retrieve them when Actions, Controllers or Entities no longer exist. 0 is not a legal Id.


Field Summary
private static int actionIdCounter
          Counter for Action Ids
private static int controllerIdCounter
          Counter for Controller Ids
private static int entityIdCounter
          Counter for Entity Ids
private static IdServer idServer
          Instance variable for singleton pattern
 
Constructor Summary
private IdServer()
          Private constructor for singleton pattern
 
Method Summary
 int getActionId()
           
 int getControllerId()
           
 int getEntityId()
           
static IdServer getInstance()
          Public static access method for singleton pattern
 void load(java.io.InputStream is)
          Loads from the stream.
 void save(java.io.OutputStream os)
          Saves on the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

idServer

private static IdServer idServer
Instance variable for singleton pattern


actionIdCounter

private static int actionIdCounter
Counter for Action Ids


controllerIdCounter

private static int controllerIdCounter
Counter for Controller Ids


entityIdCounter

private static int entityIdCounter
Counter for Entity Ids

Constructor Detail

IdServer

private IdServer()
Private constructor for singleton pattern

Method Detail

getInstance

public static IdServer getInstance()
Public static access method for singleton pattern


getActionId

public int getActionId()

getControllerId

public int getControllerId()

getEntityId

public int getEntityId()

save

public void save(java.io.OutputStream os)
          throws java.io.IOException
Saves on the stream.

Specified by:
save in interface org.metacosm.framework.persistence.Persistent

load

public void load(java.io.InputStream is)
          throws java.io.IOException
Loads from the stream.

Specified by:
load in interface org.metacosm.framework.persistence.Persistent