AnyLogic
Expand
Font size
  • java.lang.Object
    • com.anylogic.engine.database.CodeValue
All Implemented Interfaces:
java.io.Serializable

public class CodeValue
extends java.lang.Object
implements java.io.Serializable
Class containing some executable action / evaluatable expression code inside.
Author:
AnyLogic North America, LLC https://anylogic.com
See Also:
Serialized Form

Constructor Summary

Constructors 
CodeValue​(Utilities owner, java.lang.String code)
Creates new expression / action descriptor
Constructor Description

Method Summary

All Methods Instance Methods Concrete Methods 
<T> T execute​(java.lang.Class<T> returnType, java.lang.Object... argDescriptors)  
<T> T execute​(java.lang.Object... argDescriptors)
Executes/evaluates the given code, e.g.
java.lang.String getCode()
Returns the original code string contained in this object
Modifier and Type Method Description

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

CodeValue

public CodeValue​(Utilities owner,
                 java.lang.String code)
Creates new expression / action descriptor
Parameters:
owner - agent / experiment context, this action will be executed in
code - java code of expression / action

Method Detail

execute

public <T> T execute​(java.lang.Object... argDescriptors)
Executes/evaluates the given code, e.g. executeExpression( "exponential( 10 )" ).
If provided, uses the given arguments, specified in the form of pair: name, value. In the following example:
codeValue.execute( "agent", agent, "index", i - 1 )
the code will operate with variables agent and index of types Agent and Integer
Parameters:
argDescriptors - array of pairs: argName1, argValue1, argName2, argValue2, ...
Returns:
evaluated expression result (if this is an expression, not action)

execute

public <T> T execute​(java.lang.Class<T> returnType,
                     java.lang.Object... argDescriptors)

getCode

public java.lang.String getCode()
Returns the original code string contained in this object
Returns:
java code of expression / action
How can we improve this article?