Class Variables

All Implemented Interfaces:
Serializable, Cloneable, Iterable<Variable>, Collection<Variable>, List<Variable>, RandomAccess

public class Variables extends ArrayList<Variable>
The Class Variables.
See Also:
Serialized Form
  • Constructor Details

    • Variables

      public Variables(org.jdom2.Element xml)
      parse variables from XML strategy.
      Parameters:
      xml - the xml
    • Variables

      public Variables(Object object)
      parse variables from class parameters.
      Parameters:
      object - the object
  • Method Details

    • get

      public Variable get(String variableName)
      returns variable by its name or null if no such variable exists.
      Parameters:
      variableName - the variable name
      Returns:
      the variable
    • getById

      public Variable getById(String variableId)
      returns variable by its ID or null if no such variable exists.
      Parameters:
      variableId - the variable id
      Returns:
      the by id
    • getByField

      public Variable getByField(Object object, String fieldName)
      Gets the by field.
      Parameters:
      object - the object
      fieldName - 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.NonexistingVariableException
      Sets the value.
      Parameters:
      name - the name
      value - 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.NonexistingVariableException
      Sets the value in xml.
      Parameters:
      name - the name
      value - the value
      Throws:
      com.strategyquant.tradinglib.optimization.NonexistingVariableException - the nonexisting variable exception