org.jgap
Class IdFactory

java.lang.Object
  extended byorg.jgap.IdFactory

public class IdFactory
extends java.lang.Object

Factory for generating unique IDs across multiple runs.

Author:
Philip Tucker

Field Summary
static long DEFAULT_BASE_ID
          default base ID
static java.lang.String XML_TAG
          XML base tag
 
Constructor Summary
IdFactory()
          construct new factory with default values
IdFactory(java.lang.String aFileName)
          construct new factory from persisted file aFileName
 
Method Summary
 long next()
           
 void store()
          persist object to file
 java.lang.String toString()
           
 java.lang.String toXml()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_BASE_ID

public static final long DEFAULT_BASE_ID
default base ID

See Also:
Constant Field Values

XML_TAG

public static final java.lang.String XML_TAG
XML base tag

See Also:
Constant Field Values
Constructor Detail

IdFactory

public IdFactory()
construct new factory with default values


IdFactory

public IdFactory(java.lang.String aFileName)
          throws java.io.IOException
construct new factory from persisted file aFileName

Parameters:
aFileName -
Throws:
java.io.IOException
Method Detail

next

public long next()
Returns:
long next unique ID

toString

public java.lang.String toString()
See Also:
Object.toString()

toXml

public java.lang.String toXml()
Returns:
String XML representation of object

store

public void store()
           throws java.io.IOException
persist object to file

Throws:
java.io.IOException