public class Global
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AGENT_REPOSITORY
Path to agent repository
|
static java.lang.String |
DOMAIN_REPOSITORY
Path to domain repository
|
static java.lang.String |
logPrefix |
static java.lang.String |
logPreset |
static java.lang.String |
PROTOCOL_REPOSITORY
Path to protocol repository
|
static java.lang.String |
SIMULATOR_REPOSITORY
Path to simulator repository
|
Constructor and Description |
---|
Global() |
Modifier and Type | Method and Description |
---|---|
static Protocol |
createProtocolInstance(ProtocolRepItem protRepItem,
AgentRepItem[] agentRepItems,
ProfileRepItem[] profileRepItems,
java.util.HashMap<AgentParameterVariable,AgentParamValue>[] agentParams) |
static java.lang.String |
getAgentDescription(Agent agent)
Gives a useful agent name.
|
static java.lang.String |
getCurrentTime() |
static java.lang.String |
getDistributedOutcomesFileName() |
static java.lang.String |
getExtensiveOutcomesFileName() |
static java.lang.String |
getFileNameWithoutExtension(java.lang.String fileName) |
static java.lang.String |
getOQMOutcomesFileName() |
static java.lang.String |
getOutcomesFileName() |
static java.lang.Class<Protocol> |
getProtocolClass(ProtocolRepItem protRepItem) |
static java.lang.String |
getTournamentOutcomeFileName() |
static Agent |
loadAgent(java.lang.String path)
Load an agent using the given classname/filename.
|
static Agent |
loadAgent(java.lang.String agentClassName,
java.lang.String variables)
load agent and then set the parameters.
|
static java.lang.Object |
loadClassFromFile(java.io.File file)
Load a file as a class.
|
static java.lang.Object |
loadObject(java.lang.String path)
Load an object from a given path.
|
static void |
showLoadError(java.io.File fc,
java.lang.Throwable e)
Show a dialog to the user, explaining the exception that was raised while
loading file fc.
|
public static final java.lang.String DOMAIN_REPOSITORY
public static final java.lang.String AGENT_REPOSITORY
public static final java.lang.String PROTOCOL_REPOSITORY
public static final java.lang.String SIMULATOR_REPOSITORY
public static java.lang.String logPrefix
public static java.lang.String logPreset
public static java.lang.String getCurrentTime()
public static java.lang.String getFileNameWithoutExtension(java.lang.String fileName)
public static java.lang.Class<Protocol> getProtocolClass(ProtocolRepItem protRepItem) throws java.lang.Exception
java.lang.Exception
public static Protocol createProtocolInstance(ProtocolRepItem protRepItem, AgentRepItem[] agentRepItems, ProfileRepItem[] profileRepItems, java.util.HashMap<AgentParameterVariable,AgentParamValue>[] agentParams) throws java.lang.Exception
java.lang.Exception
public static java.lang.Object loadObject(java.lang.String path) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.net.MalformedURLException
we can't properly typecheck here. Generics fail as we have type erasure, and casting to the given type does NOTHING. So we leave this a general object and leave it to the caller to do the type checking.
path
- This can be either a class name or filename.Object
in the given filejava.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.net.MalformedURLException
public static java.lang.Object loadClassFromFile(java.io.File file) throws java.net.MalformedURLException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException
file
- the object to be loaded. Filename should end with ".class".java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.net.MalformedURLException
public static Agent loadAgent(java.lang.String path) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.net.MalformedURLException, java.lang.ClassCastException, java.lang.IllegalArgumentException
Agent.parseStrategyParameters(String)
path
- This can be either a class name or filename.java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalArgumentException
java.lang.ClassCastException
java.net.MalformedURLException
public static Agent loadAgent(java.lang.String agentClassName, java.lang.String variables) throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.ClassNotFoundException, java.net.MalformedURLException, java.lang.ClassCastException, java.lang.IllegalArgumentException
loadAgent(String)
agentClassName
- variables
- the variables to use, as string (eg, "time=0.9;e=1.0").java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.net.MalformedURLException
java.lang.ClassCastException
java.lang.IllegalArgumentException
public static java.lang.String getAgentDescription(Agent agent)
public static void showLoadError(java.io.File fc, java.lang.Throwable e)
loadObject(String)
and associates. Also dumps a copy of the full
stacktrace to the console, to help us debugging #906fc
- file that was attempted to be loadede
- the exception that was raisedpublic static java.lang.String getOutcomesFileName()
public static java.lang.String getDistributedOutcomesFileName()
public static java.lang.String getTournamentOutcomeFileName()
public static java.lang.String getExtensiveOutcomesFileName()
public static java.lang.String getOQMOutcomesFileName()