blob: c5f49bfcfeb09483aaf50adae43f38b6d3c3d862 [file] [log] [blame]
package org.metaabm.gen.test;
/**
* Basic Model Java Implementation.
*
* Generated by metaabm system: May 13, 2009 11:53:52 AM PDT in project: org.metaabm.gen.repast.test (testing) */
import static org.junit.Assert.*;
public class BasicModel extends repast.simphony.context.DefaultContext
implements
repast.simphony.dataLoader.ContextBuilder,
IBasicModel {
/**
*
*/
private boolean someFlag = true;
/**
* The number of generated member agents to create.
*/
private int generatedMemberAgentCount = 10;
/**
*
*/
private int someInteger = 45;
/**
*
*/
private double someFloat = 1.8;
/**
* The number of operations agents to create.
*/
private int operationsAgentCount = 0;
/**
* The number of state agents to create.
*/
private int stateAgentCount = 0;
/**
* The number of methods agents to create.
*/
private int methodsAgentCount = 0;
/**
* Constructs a new Basic Model.
*/
public BasicModel() {
createUniqueID();
}
repast.simphony.context.Context buildContext;
//todo, make this a useful value for evaluating compatibility of different versions of generated classes
private static final long serialVersionUID = 89989998L;
private String uniqueID;
public String getUID() {
return uniqueID;
}
public void createUniqueID() {
uniqueID = org.apache.commons.lang.RandomStringUtils
.randomAlphanumeric(5);
}
/**
* Clones the agent, ensuring that a unique id is assigned.
*/
public Object clone() {
try {
BasicModel clone = (BasicModel) super.clone();
clone.createUniqueID();
return clone;
} catch (Exception e) {
throw new RuntimeException("Unexpected cloning exception: " + e);
}
}
@org.junit.Test
public void dummy() {
assertTrue(true);
}
public repast.simphony.context.Context getContext() {
return buildContext;
}
/**
* Builds and returns a context based on MetaABM generation for repast.simphony. Building a context consists of filling it with
* agents, adding projects and so forth. When this is called for the master context
* the system will pass in a created context based on information given in the
* model.score file. When called for subcontexts, each subcontext that was added
* when the master context was built will be passed in.
*
* @param context
* @return the built context.
*/
public repast.simphony.context.Context build(
repast.simphony.context.Context context) {
this.buildContext = context;
OperationsAgent createOperationsAgents = null;
for (int i = 0; i < getOperationsAgentCount(); i++) {
createOperationsAgents = new OperationsAgent();
context.add(createOperationsAgents);
createOperationsAgents.setBasicModel(this);
}
StateAgent createStateAgents = null;
for (int i = 0; i < getStateAgentCount(); i++) {
createStateAgents = new StateAgent();
context.add(createStateAgents);
createStateAgents.setBasicModel(this);
}
MethodsAgent createMethodsAgents = null;
for (int i = 0; i < getMethodsAgentCount(); i++) {
createMethodsAgents = new MethodsAgent();
context.add(createMethodsAgents);
createMethodsAgents.setBasicModel(this);
}
return context;
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -2)
public void testFake() {
/*PROTECTED REGION ID(BasicModel_testFake_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
assertTrue(true);
/*PROTECTED REGION ID(BasicModel_testFake_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* Gets the Some Flag property for Basic Model.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Some Flag", usageName = "someFlag", defaultValue = "true")
public boolean isSomeFlag() {
return someFlag;
}
/**
* Sets the Some Flag property for Basic Model.
*
* @param _someFlag the new Some Flag value
*/
public void setSomeFlag(boolean _someFlag) {
someFlag = _someFlag;
}
/**
* Gets the Generated Member Agent Count property for Basic Model.
* @return The number of generated member agents to create.
*/
@repast.simphony.parameter.Parameter(displayName = "Generated Member Agent Count", usageName = "generatedMemberAgentCount", defaultValue = "10")
public int getGeneratedMemberAgentCount() {
return generatedMemberAgentCount;
}
/**
* Sets the Generated Member Agent Count property for Basic Model.
* The number of generated member agents to create.
* @param _generatedMemberAgentCount the new Generated Member Agent Count value
*/
public void setGeneratedMemberAgentCount(int _generatedMemberAgentCount) {
generatedMemberAgentCount = _generatedMemberAgentCount;
}
/**
* Gets the Some Integer property for Basic Model.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Some Integer", usageName = "someInteger", defaultValue = "45")
public int getSomeInteger() {
return someInteger;
}
/**
* Sets the Some Integer property for Basic Model.
*
* @param _someInteger the new Some Integer value
*/
public void setSomeInteger(int _someInteger) {
someInteger = _someInteger;
}
/**
* Gets the Some Float property for Basic Model.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Some Float", usageName = "someFloat", defaultValue = "1.8")
public double getSomeFloat() {
return someFloat;
}
/**
* Sets the Some Float property for Basic Model.
*
* @param _someFloat the new Some Float value
*/
public void setSomeFloat(double _someFloat) {
someFloat = _someFloat;
}
/**
* Gets the Operations Agent Count property for Basic Model.
* @return The number of operations agents to create.
*/
@repast.simphony.parameter.Parameter(displayName = "Operations Agent Count", usageName = "operationsAgentCount", defaultValue = "0")
public int getOperationsAgentCount() {
return operationsAgentCount;
}
/**
* Sets the Operations Agent Count property for Basic Model.
* The number of operations agents to create.
* @param _operationsAgentCount the new Operations Agent Count value
*/
public void setOperationsAgentCount(int _operationsAgentCount) {
operationsAgentCount = _operationsAgentCount;
}
/**
* Gets the State Agent Count property for Basic Model.
* @return The number of state agents to create.
*/
@repast.simphony.parameter.Parameter(displayName = "State Agent Count", usageName = "stateAgentCount", defaultValue = "0")
public int getStateAgentCount() {
return stateAgentCount;
}
/**
* Sets the State Agent Count property for Basic Model.
* The number of state agents to create.
* @param _stateAgentCount the new State Agent Count value
*/
public void setStateAgentCount(int _stateAgentCount) {
stateAgentCount = _stateAgentCount;
}
/**
* Gets the Methods Agent Count property for Basic Model.
* @return The number of methods agents to create.
*/
@repast.simphony.parameter.Parameter(displayName = "Methods Agent Count", usageName = "methodsAgentCount", defaultValue = "0")
public int getMethodsAgentCount() {
return methodsAgentCount;
}
/**
* Sets the Methods Agent Count property for Basic Model.
* The number of methods agents to create.
* @param _methodsAgentCount the new Methods Agent Count value
*/
public void setMethodsAgentCount(int _methodsAgentCount) {
methodsAgentCount = _methodsAgentCount;
}
}