|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cuny.cat.Game
public final class Game
Main class of jcat when jcat is run as a Java application to launch a game,
including a GameServer
and multiple GameClient
s.
Parameters
cat.server |
(the parameter base for GameServer) |
cat.agent.n int >=0 |
(the number of subpopulations of trader clients) |
cat.agent.n class, being or inheriting TraderClient |
(the class of trader clients for the nth trader subpopulation) |
cat.specialist.n int >=0 |
(the number of subpopulations of specialist clients) |
cat.specialist.n class, being or inheriting MarketClient |
(the class of market clients for the nth specialist subpopulation) |
cat.specialist.optional.dir string |
(the directory to look for the configurations of optional market clients) |
cat.specialist.optional.base string |
(the base of parameters used to specify the configurations of
optional market clients in the parameter files located in
cat.specialist.optional.dir ) |
Field Summary | |
---|---|
static java.lang.String |
BANNER
|
protected static ClientSynchronizer |
clientSynchronizer
|
static java.lang.String |
EMAIL
|
protected static IdentityOffice |
identityOffice
|
static int |
majorVersion
|
static int |
minorVersion
|
static java.lang.String |
NAME
|
static java.lang.String |
P_AGENT
|
static java.lang.String |
P_BASE
|
static java.lang.String |
P_CAT
|
static java.lang.String |
P_DIR
|
static java.lang.String |
P_GUI_APPENDER
|
static java.lang.String |
P_INFRASTRUCTURE
|
static java.lang.String |
P_NAME
|
static java.lang.String |
P_NUM
|
static java.lang.String |
P_OPTIONAL
|
static java.lang.String |
P_SERVER
|
static java.lang.String |
P_SPECIALIST
|
static java.lang.String |
P_VERSION
|
Constructor Summary | |
---|---|
Game()
|
Method Summary | |
---|---|
static void |
cleanUpAfterInitialization()
|
static void |
cleanupObjectRegistry()
|
static java.util.Collection<? extends MarketClient> |
createMarkets()
creates multiple market/specialist clients using the default parameter base for specialists. |
static java.util.Collection<? extends MarketClient> |
createMarkets(edu.cuny.config.param.Parameter base)
creates multiple market/specialist clients, each an instance of MarketClient , initializes them with parameter database in
ObjectRegistry using the given parameter base. |
static java.util.Collection<? extends MarketClient> |
createMarkets(edu.cuny.config.param.ParameterDatabase parameters,
edu.cuny.config.param.Parameter base)
creates multiple market/specialist clients, each an instance of MarketClient , initializes them with the given parameter database
and using the given parameter base. |
static java.util.Collection<? extends MarketClient> |
createOptionalMarkets()
creates multiple market/specialist clients, each an instance of MarketClient , based on parameter files in the specified directory
and its subdirectories. |
static GameServer |
createServer()
creates an instance of GameServer and initializes it with parameter
database in the object galaxy. |
static java.util.Collection<? extends TraderClient> |
createTraders()
creates multiple traders, each an instance of TraderClient ,
initializes them with parameter database in the object galaxy, and starts
them. |
static java.lang.String |
getBanner()
|
static java.lang.String |
getDefaultParameterFile()
|
static java.lang.String |
getName()
|
static java.lang.String |
getParameterFile(java.lang.String[] args)
retrieves the name of the parameter file from command line arguments; or the default file is used if no argument is present. |
static java.lang.String |
getVersion()
|
static void |
main(java.lang.String[] args)
initializes Galaxy , GameServer ,
MarketClient s, and TraderClient s. |
static void |
makeSureUnsynchronousInfrastructure()
|
static void |
setupObjectRegistry()
|
static void |
setupPreferences(edu.cuny.config.param.ParameterDatabase parameters)
sets up the preferences of JCAT using the parameter database. |
static void |
setupPreferences(java.net.URL url,
java.lang.String[] args)
|
static void |
setupPreferences(java.net.URL url,
java.lang.String[] args,
boolean startLogging)
does the following: initializes log4j with the parameter file loads a parameter file into a ParameterDatabase
invokes setupPreferences(ParameterDatabase) to setup
preferences using the ParameterDatabase ;
|
static void |
startMarkets(java.util.Collection<? extends MarketClient> marketColl)
|
static void |
startServer(GameServer server)
|
static void |
startTraders(java.util.Collection<? extends TraderClient> traderColl)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int minorVersion
public static final int majorVersion
public static final java.lang.String NAME
public static final java.lang.String EMAIL
public static final java.lang.String BANNER
public static final java.lang.String P_CAT
public static final java.lang.String P_VERSION
public static final java.lang.String P_NAME
public static final java.lang.String P_INFRASTRUCTURE
public static final java.lang.String P_GUI_APPENDER
public static final java.lang.String P_SERVER
public static final java.lang.String P_AGENT
public static final java.lang.String P_SPECIALIST
public static final java.lang.String P_OPTIONAL
public static final java.lang.String P_DIR
public static final java.lang.String P_BASE
public static final java.lang.String P_NUM
protected static IdentityOffice identityOffice
protected static ClientSynchronizer clientSynchronizer
Constructor Detail |
---|
public Game()
Method Detail |
---|
public static java.lang.String getDefaultParameterFile()
public static java.lang.String getParameterFile(java.lang.String[] args)
args
- command line arguments
public static void main(java.lang.String[] args)
Galaxy
, GameServer
,
MarketClient
s, and TraderClient
s.
args
- command line argumentspublic static void setupObjectRegistry()
public static void cleanupObjectRegistry()
public static void setupPreferences(java.net.URL url, java.lang.String[] args)
public static void setupPreferences(java.net.URL url, java.lang.String[] args, boolean startLogging)
ParameterDatabase
setupPreferences(ParameterDatabase)
to setup
preferences using the ParameterDatabase
;
url
- where the parameter file is located.args
- command line arguments transferred from main()
.startLogging
- configures log4j for logging if true, or not otherwise.public static void setupPreferences(edu.cuny.config.param.ParameterDatabase parameters)
parameters
- public static GameServer createServer()
GameServer
and initializes it with parameter
database in the object galaxy.
public static void startServer(GameServer server)
public static java.util.Collection<? extends TraderClient> createTraders() throws java.lang.InstantiationException, java.lang.IllegalAccessException
TraderClient
,
initializes them with parameter database in the object galaxy, and starts
them.
java.lang.InstantiationException
- if fails to instantiate trader clients
java.lang.IllegalAccessException
public static void startTraders(java.util.Collection<? extends TraderClient> traderColl)
public static java.util.Collection<? extends MarketClient> createMarkets() throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
- if fails to instantiate market clients
java.lang.IllegalAccessException
createMarkets(Parameter)
public static java.util.Collection<? extends MarketClient> createMarkets(edu.cuny.config.param.Parameter base) throws java.lang.InstantiationException, java.lang.IllegalAccessException
MarketClient
, initializes them with parameter database in
ObjectRegistry
using the given parameter base.
java.lang.InstantiationException
- if fails to instantiate market clients
java.lang.IllegalAccessException
public static java.util.Collection<? extends MarketClient> createMarkets(edu.cuny.config.param.ParameterDatabase parameters, edu.cuny.config.param.Parameter base) throws java.lang.InstantiationException, java.lang.IllegalAccessException
MarketClient
, initializes them with the given parameter database
and using the given parameter base.
parameters
- base
-
java.lang.InstantiationException
java.lang.IllegalAccessException
public static java.util.Collection<? extends MarketClient> createOptionalMarkets() throws java.lang.InstantiationException, java.lang.IllegalAccessException
MarketClient
, based on parameter files in the specified directory
and its subdirectories. Each of these parameter files define a set of
market clients using the specified parameter base.
For example
cat.specialist.optional.dir = params/elites cat.specialist.optional.base = elitesspecifies to look for parameter files in the directory
params/elites
and all market clients are configured using the
parameter base elites
.
java.lang.InstantiationException
java.lang.IllegalAccessException
public static void startMarkets(java.util.Collection<? extends MarketClient> marketColl)
public static void cleanUpAfterInitialization()
public static void makeSureUnsynchronousInfrastructure() throws CatpServerUnavailableException
CatpServerUnavailableException
public static java.lang.String getBanner()
public static java.lang.String getVersion()
public static java.lang.String getName()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |