Package com.strategyquant.tradinglib
Class Variables
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<Variable>
,Collection<Variable>
,List<Variable>
,RandomAccess
The Class Variables.
- See Also:
- Serialized Form
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canSetValue(String name)
returns variable by its name or null if no such variable exists.getByField(Object object, String fieldName)
Gets the by field.returns variable by its ID or null if no such variable exists.void
Sets the value.void
setValueInXml(String name, double value)
Sets the value in xml.void
Sort by name.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll
-
Constructor Details
-
Variables
public Variables(org.jdom2.Element xml)parse variables from XML strategy.- Parameters:
xml
- the xml
-
Variables
parse variables from class parameters.- Parameters:
object
- the object
-
-
Method Details
-
get
returns variable by its name or null if no such variable exists.- Parameters:
variableName
- the variable name- Returns:
- the variable
-
getById
returns variable by its ID or null if no such variable exists.- Parameters:
variableId
- the variable id- Returns:
- the by id
-
getByField
Gets the by field.- Parameters:
object
- the objectfieldName
- the field name- Returns:
- the by field
-
sortByName
public void sortByName()Sort by name. -
setValue
public void setValue(String name, double value) throws com.strategyquant.tradinglib.optimization.NonexistingVariableExceptionSets the value.- Parameters:
name
- the namevalue
- the value- Throws:
com.strategyquant.tradinglib.optimization.NonexistingVariableException
- the nonexisting variable exception
-
canSetValue
public boolean canSetValue(String name) throws com.strategyquant.tradinglib.optimization.NonexistingVariableException- Throws:
com.strategyquant.tradinglib.optimization.NonexistingVariableException
-
setValueInXml
public void setValueInXml(String name, double value) throws com.strategyquant.tradinglib.optimization.NonexistingVariableExceptionSets the value in xml.- Parameters:
name
- the namevalue
- the value- Throws:
com.strategyquant.tradinglib.optimization.NonexistingVariableException
- the nonexisting variable exception
-