blob: 4546453c082d55fd03cc5085fa26645359c47b1e [file] [log] [blame]
package org.metaabm.gen.test;
/**
* Operations Agent 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 OperationsAgent {
/**
*
*/
private double float12 = 12.0;
/**
*
*/
private double float20 = 20;
/**
*
*/
private double float1p8 = 1.8;
/**
*
*/
private boolean resultBoolean = false;
/**
*
*/
private double floatResult1 = 0.0;
/**
*
*/
private boolean complexResultCorrect = false;
/**
*
*/
private int complexResultValue = 0;
/**
*
*/
private int constant3 = 3;
/**
*
*/
private int countChanges = 0;
/**
*
*/
private int temp1 = 1;
/**
*
*/
private int int1 = 1;
/**
*
*/
private int int2 = 2;
/**
*
*/
private int int3 = 3;
/**
*
*/
private int int4 = 4;
/**
*
*/
private int int10 = 10;
/**
*
*/
private boolean boolean1 = false;
/**
*
*/
private boolean boolean2 = false;
/**
* Constructs a new Operations Agent.
*/
public OperationsAgent() {
createUniqueID();
}
//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 {
OperationsAgent clone = (OperationsAgent) super.clone();
clone.createUniqueID();
return clone;
} catch (Exception e) {
throw new RuntimeException("Unexpected cloning exception: " + e);
}
}
@org.junit.Test
public void dummy() {
assertTrue(true);
}
/**
*
*/
private BasicModel basicModelList = null;
/**
* Gets the Basic Model property for .
* @return
*/
public BasicModel getBasicModel() {
return basicModelList;
}
/**
* Sets the Basic Model property for .
*
* @param _basicModel the new Basic Model value
*/
public void setBasicModel(BasicModel _basicModel) {
basicModelList = _basicModel;
}
public double randomInRange(double minValue, double maxValue) {
return repast.simphony.random.RandomHelper.nextDoubleFromTo(minValue,
maxValue);
}
public double randomToLimit(double maxValue) {
return repast.simphony.random.RandomHelper.nextDoubleFromTo(0.0,
maxValue);
}
public int randomToLimit(int maxValue) {
return repast.simphony.random.RandomHelper.nextIntFromTo(0, maxValue);
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -0)
public void testSimpleCondition() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testSimpleCondition_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
assertFalse(resultBoolean);
if (getFloat12() <= getFloat20()) {
setFloat1p8(getFloat20());
{
assertEquals(float1p8, 20.0);
assertEquals(float1p8, 20.0);
if (getFloat1p8() == getFloat20()) {
setFloat20(3);
assertEquals(float1p8, 20.0);
{
if (getFloat20() == 3) {
assertEquals(float20, 3.0);
setFloatResult1(getInt10());
assertEquals(floatResult1, 10.0);
}
}
}
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testSimpleCondition_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -4)
public void testSimpleConjunction() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testSimpleConjunction_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
{
{
if ((getFloat12() <= getFloat20() && getFloat20() > getFloat1p8())) {
setResultBoolean(true);
}
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testSimpleConjunction_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -9)
public void testSimpleMath() {
/*PROTECTED REGION ID(OperationsAgent_testSimpleMath_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
double valueFloat12MultiplyFloat1p8 = getFloat12() * getFloat1p8();
setFloatResult1(valueFloat12MultiplyFloat1p8);
assertEquals(getFloatResult1(), 21.6);
/*PROTECTED REGION ID(OperationsAgent_testSimpleMath_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -13)
public void testComplexMath() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testComplexMath_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
int valueInt10ModuloInt3 = getInt10() % getInt3();
int valueInt10DivideInt3 = getInt10() / getInt3();
int valueConstant3MultiplyValueInt10DivideInt3 = 3 * valueInt10DivideInt3;
int valueValueConstant3MultiplyValueInt10DivideInt3AddValueInt10ModuloInt3 = valueConstant3MultiplyValueInt10DivideInt3
+ valueInt10ModuloInt3;
{
setComplexResultValue(valueValueConstant3MultiplyValueInt10DivideInt3AddValueInt10ModuloInt3);
assertEquals(complexResultValue, 10);
if (getInt10() == valueValueConstant3MultiplyValueInt10DivideInt3AddValueInt10ModuloInt3) {
setComplexResultCorrect(true);
assertTrue(complexResultCorrect);
}
}
/*PROTECTED REGION ID(OperationsAgent_testComplexMath_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -30)
public void testSimpleOR() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testSimpleOR_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
{
{
if ((getFloat1p8() < getFloat20() || getFloat1p8() == getFloat20())) {
setFloatResult1(3);
int valueIncrementCountChanges = getCountChanges() + 1;
setCountChanges(valueIncrementCountChanges);
}
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testSimpleOR_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -38)
public void testLiterals() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testLiterals_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
if (3 <= 4) {
setFloatResult1(3);
assertEquals(floatResult1, 3.0);
}
}
/*PROTECTED REGION ID(OperationsAgent_testLiterals_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -42)
public void testNegate() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testNegate_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
if (isResultBoolean()) {
setFloat12(getFloat20());
}
{
if (!(isResultBoolean())) {
setFloat12(getFloat1p8());
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testNegate_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -47)
public void testIdentity() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testIdentity_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
if (isResultBoolean()) {
setFloat12(getFloat20());
}
}
/*PROTECTED REGION ID(OperationsAgent_testIdentity_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -50)
public void testNegateComplex() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testNegateComplex_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
{
{
{
if ((getFloat20() >= getFloat12() && getInt3() == 3)) {
setFloatResult1(getInt2());
}
}
{
if ((!((getFloat20() >= getFloat12() && getInt3() == 3)) || getFloat20() < getFloat12())) {
setFloatResult1(getInt3());
}
}
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testNegateComplex_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -58)
public void testComplexConjunction() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testComplexConjunction_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
{
{
{
{
if ((true == isResultBoolean()
|| getInt1() == getFloatResult1()
|| 3 == getInt3() || getFloat12() == 12.0)) {
setFloatResult1(getInt1());
}
}
{
if (((true == isResultBoolean()
|| getInt1() == getFloatResult1()
|| 3 == getInt3() || getFloat12() == 12.0) && true == isResultBoolean())) {
setFloatResult1(getInt2());
}
}
}
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testComplexConjunction_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -69)
public void testExclusiveConjunctions() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testExclusiveConjunctions_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
{
{
{
{
{
if ((isBoolean1() && !isBoolean2())) {
setBoolean2(true);
assertEquals(floatResult1, 12.0);
}
if ((!isBoolean1() && !isBoolean2())) {
setFloatResult1(getFloat12());
assertEquals(floatResult1, 12.0);
}
}
}
{
if ((isBoolean1() && isBoolean2())) {
setBoolean1(true);
assertEquals(floatResult1, 12.0);
assertEquals(floatResult1, 12.0);
}
}
{
if ((isBoolean2() && !isBoolean1())) {
setResultBoolean(true);
assertEquals(floatResult1, 12.0);
}
}
}
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testExclusiveConjunctions_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -82)
public void testMultiplePaths() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testMultiplePaths_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
{
if (getFloat20() <= getFloat12()) {
setFloat1p8(getFloat12());
setFloat1p8(getFloat20());
}
if (getFloat20() >= getFloat12()) {
setFloat1p8(getFloat12());
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testMultiplePaths_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -92)
public void testNegateSameTarget() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testNegateSameTarget_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
{
{
if (getInt10() == 3 && getInt10() < 3) {
setComplexResultValue(getInt2());
setFloatResult1(getInt10());
}
}
{
{
if (getInt10() > 3 && !(getInt10() < 3)) {
setFloatResult1(getInt10());
}
}
}
if (getInt10() == 3 && getInt10() < 3) {
setComplexResultValue(getInt2());
setFloatResult1(getInt10());
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testNegateSameTarget_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -99)
public void testNegateMultipleTargets() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testNegateMultipleTargets_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
double ignoreEval = getFloat1p8() + 12.0;
{
{
{
if (!(getFloat12() != getFloat12() && getFloat20() != getFloat20())) {
double testNegateMultipleTargetsFloatResult1AddLiteral2 = getFloatResult1() + 2;
setFloatResult1(testNegateMultipleTargetsFloatResult1AddLiteral2);
}
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testNegateMultipleTargets_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -105)
public void testNegateOr() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testNegateOr_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
{
{
if (!((getFloat12() == 3 || getFloat12() == getFloat1p8()))) {
double testNegateOrFloatResult1AddLiteral2 = getFloatResult1() + 2;
setFloatResult1(testNegateOrFloatResult1AddLiteral2);
}
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testNegateOr_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* .
*/
@org.junit.Test
@repast.simphony.engine.schedule.ScheduledMethod(start = 1, interval = 1, priority = -112)
public void testNestedCondition() {
final repast.simphony.context.Context context = repast.simphony.util.ContextUtils
.getContext(this);
/*PROTECTED REGION ID(OperationsAgent_testNestedCondition_Pre) ENABLED START*/
//Pre-Conditions Here
/*PROTECTED REGION END*/
{
{
if (getFloat20() > getFloat1p8()
&& getFloat20() < getFloat1p8()) {
setResultBoolean(true);
}
}
}
/*PROTECTED REGION ID(OperationsAgent_testNestedCondition_Post) ENABLED START*/
//Post-Conditions Here
/*PROTECTED REGION END*/
}
/**
* Gets the Float 12 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Float 12", usageName = "float12", defaultValue = "12.0")
public double getFloat12() {
return float12;
}
/**
* Sets the Float 12 property for Operations Agent.
*
* @param _float12 the new Float 12 value
*/
public void setFloat12(double _float12) {
float12 = _float12;
}
/**
* Gets the Float 20 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Float 20", usageName = "float20", defaultValue = "20")
public double getFloat20() {
return float20;
}
/**
* Sets the Float 20 property for Operations Agent.
*
* @param _float20 the new Float 20 value
*/
public void setFloat20(double _float20) {
float20 = _float20;
}
/**
* Gets the Float 1p8 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Float 1p8", usageName = "float1p8", defaultValue = "1.8")
public double getFloat1p8() {
return float1p8;
}
/**
* Sets the Float 1p8 property for Operations Agent.
*
* @param _float1p8 the new Float 1p8 value
*/
public void setFloat1p8(double _float1p8) {
float1p8 = _float1p8;
}
/**
* Gets the Result Boolean property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Result Boolean", usageName = "resultBoolean", defaultValue = "false")
public boolean isResultBoolean() {
return resultBoolean;
}
/**
* Sets the Result Boolean property for Operations Agent.
*
* @param _resultBoolean the new Result Boolean value
*/
public void setResultBoolean(boolean _resultBoolean) {
resultBoolean = _resultBoolean;
}
/**
* Gets the Float Result 1 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Float Result 1", usageName = "floatResult1", defaultValue = "0.0")
public double getFloatResult1() {
return floatResult1;
}
/**
* Sets the Float Result 1 property for Operations Agent.
*
* @param _floatResult1 the new Float Result 1 value
*/
public void setFloatResult1(double _floatResult1) {
floatResult1 = _floatResult1;
}
/**
* Gets the Complex Result Correct property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Complex Result Correct", usageName = "complexResultCorrect", defaultValue = "false")
public boolean isComplexResultCorrect() {
return complexResultCorrect;
}
/**
* Sets the Complex Result Correct property for Operations Agent.
*
* @param _complexResultCorrect the new Complex Result Correct value
*/
public void setComplexResultCorrect(boolean _complexResultCorrect) {
complexResultCorrect = _complexResultCorrect;
}
/**
* Gets the Complex Result Value property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Complex Result Value", usageName = "complexResultValue", defaultValue = "0")
public int getComplexResultValue() {
return complexResultValue;
}
/**
* Sets the Complex Result Value property for Operations Agent.
*
* @param _complexResultValue the new Complex Result Value value
*/
public void setComplexResultValue(int _complexResultValue) {
complexResultValue = _complexResultValue;
}
/**
* Gets the Constant3 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Constant3", usageName = "constant3", defaultValue = "3")
public int getConstant3() {
return constant3;
}
/**
* Sets the Constant3 property for Operations Agent.
*
* @param _constant3 the new Constant3 value
*/
public void setConstant3(int _constant3) {
constant3 = _constant3;
}
/**
* Gets the Count Changes property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Count Changes", usageName = "countChanges", defaultValue = "0")
public int getCountChanges() {
return countChanges;
}
/**
* Sets the Count Changes property for Operations Agent.
*
* @param _countChanges the new Count Changes value
*/
public void setCountChanges(int _countChanges) {
countChanges = _countChanges;
}
/**
* Gets the Temp 1 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Temp 1", usageName = "temp1", defaultValue = "1")
public int getTemp1() {
return temp1;
}
/**
* Sets the Temp 1 property for Operations Agent.
*
* @param _temp1 the new Temp 1 value
*/
public void setTemp1(int _temp1) {
temp1 = _temp1;
}
/**
* Gets the Int 1 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Int 1", usageName = "int1", defaultValue = "1")
public int getInt1() {
return int1;
}
/**
* Sets the Int 1 property for Operations Agent.
*
* @param _int1 the new Int 1 value
*/
public void setInt1(int _int1) {
int1 = _int1;
}
/**
* Gets the Int 2 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Int 2", usageName = "int2", defaultValue = "2")
public int getInt2() {
return int2;
}
/**
* Sets the Int 2 property for Operations Agent.
*
* @param _int2 the new Int 2 value
*/
public void setInt2(int _int2) {
int2 = _int2;
}
/**
* Gets the Int 3 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Int 3", usageName = "int3", defaultValue = "3")
public int getInt3() {
return int3;
}
/**
* Sets the Int 3 property for Operations Agent.
*
* @param _int3 the new Int 3 value
*/
public void setInt3(int _int3) {
int3 = _int3;
}
/**
* Gets the Int 4 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Int 4", usageName = "int4", defaultValue = "4")
public int getInt4() {
return int4;
}
/**
* Sets the Int 4 property for Operations Agent.
*
* @param _int4 the new Int 4 value
*/
public void setInt4(int _int4) {
int4 = _int4;
}
/**
* Gets the Int 10 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Int 10", usageName = "int10", defaultValue = "10")
public int getInt10() {
return int10;
}
/**
* Sets the Int 10 property for Operations Agent.
*
* @param _int10 the new Int 10 value
*/
public void setInt10(int _int10) {
int10 = _int10;
}
/**
* Gets the Boolean 1 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Boolean 1", usageName = "boolean1", defaultValue = "false")
public boolean isBoolean1() {
return boolean1;
}
/**
* Sets the Boolean 1 property for Operations Agent.
*
* @param _boolean1 the new Boolean 1 value
*/
public void setBoolean1(boolean _boolean1) {
boolean1 = _boolean1;
}
/**
* Gets the Boolean 2 property for Operations Agent.
* @return
*/
@repast.simphony.parameter.Parameter(displayName = "Boolean 2", usageName = "boolean2", defaultValue = "false")
public boolean isBoolean2() {
return boolean2;
}
/**
* Sets the Boolean 2 property for Operations Agent.
*
* @param _boolean2 the new Boolean 2 value
*/
public void setBoolean2(boolean _boolean2) {
boolean2 = _boolean2;
}
}