Package com.strategyquant.tradinglib
Class Variable
java.lang.Object
com.strategyquant.tradinglib.Variable
The Class Variable.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringThe Constant DayTradeOn.static org.slf4j.LoggerThe Constant Log.static byteThe Constant TypeBoolean.static byteThe Constant TypeCustomParam.static byteThe Constant TypeDouble.static byteThe Constant TypeInt.static byteThe Constant TypeString.static byteThe Constant TypeTime.static byteThe Constant TypeUnknown. -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a new variable.Variable(String id, String name, String type, String value, boolean autoGenerated, boolean makeExternal)Instantiates a new variable.Variable(String id, String name, String type, String value, boolean autoGenerated, String paramType, boolean makeExternal)Instantiates a new variable.Variable(org.jdom2.Element elVariable)Instantiates a new variable. -
Method Summary
Modifier and TypeMethodDescriptiongetClone()getId()Gets the id.byteGets the internal type.doublegetMax()Gets the max.doublegetMin()Gets the min.getName()Gets the name.Gets the param type.getType()Gets the type.getValue()Gets the value.booleanGets the value as boolean.doubleGets the value as double.intGets the value as int.org.jdom2.ElementgetXML()Gets the xml.booleanChecks if is auto generated.booleanChecks if is make external.booleanisObjectRegistered(Object object, String fieldName)Checks if is object registered.voidregisterAttachedField(Object object, Field field)registers field that is attached to this variable.voidsetFromString(String newValue)Sets the from string.voidsetMakeExternal(boolean makeExternal)Sets the make external.voidsetMinMax(double min, double max)Sets the min max.voidsetParamType(String paramType)Sets the param type.voidsetValue(boolean newValue)Sets the value.voidsetValue(double newValue)Sets the value.voidsetValue(int newValue)Sets the value.voidSets the value.voidsetValueInXml(double newValue)Sets the value in xml.toString()To string.translateType(byte type)Translate type.
-
Field Details
-
Log
public static final org.slf4j.Logger LogThe Constant Log. -
TypeUnknown
public static final byte TypeUnknownThe Constant TypeUnknown.- See Also:
- Constant Field Values
-
TypeInt
public static final byte TypeIntThe Constant TypeInt.- See Also:
- Constant Field Values
-
TypeBoolean
public static final byte TypeBooleanThe Constant TypeBoolean.- See Also:
- Constant Field Values
-
TypeString
public static final byte TypeStringThe Constant TypeString.- See Also:
- Constant Field Values
-
TypeDouble
public static final byte TypeDoubleThe Constant TypeDouble.- See Also:
- Constant Field Values
-
TypeTime
public static final byte TypeTimeThe Constant TypeTime.- See Also:
- Constant Field Values
-
TypeCustomParam
public static final byte TypeCustomParamThe Constant TypeCustomParam.- See Also:
- Constant Field Values
-
DayTradeOn
The Constant DayTradeOn.- See Also:
- Constant Field Values
-
-
Constructor Details
-
Variable
public Variable(org.jdom2.Element elVariable)Instantiates a new variable.- Parameters:
elVariable- the el variable
-
Variable
public Variable(String id, String name, String type, String value, boolean autoGenerated, boolean makeExternal)Instantiates a new variable.- Parameters:
id- the idname- the nametype- the typevalue- the valueautoGenerated- the auto generatedmakeExternal- the make external
-
Variable
public Variable(String id, String name, String type, String value, boolean autoGenerated, String paramType, boolean makeExternal)Instantiates a new variable.- Parameters:
id- the idname- the nametype- the typevalue- the valueautoGenerated- the auto generatedparamType- the param typemakeExternal- the make external
-
Variable
Instantiates a new variable.- Parameters:
object- the objectfield- the field
-
-
Method Details
-
getId
Gets the id.- Returns:
- the id
-
getValue
Gets the value.- Returns:
- the value
-
getName
Gets the name.- Returns:
- the name
-
getType
Gets the type.- Returns:
- the type
-
getInternalType
public byte getInternalType()Gets the internal type.- Returns:
- the internal type
-
getValueAsInt
public int getValueAsInt()Gets the value as int.- Returns:
- the value as int
-
getValueAsDouble
public double getValueAsDouble()Gets the value as double.- Returns:
- the value as double
-
getValueAsBoolean
public boolean getValueAsBoolean()Gets the value as boolean.- Returns:
- the value as boolean
-
registerAttachedField
registers field that is attached to this variable.- Parameters:
object- the objectfield- the field
-
setValue
public void setValue(int newValue)Sets the value.- Parameters:
newValue- the new value
-
setValue
public void setValue(double newValue)Sets the value.- Parameters:
newValue- the new value
-
setValue
public void setValue(boolean newValue)Sets the value.- Parameters:
newValue- the new value
-
setValue
Sets the value.- Parameters:
newValue- the new value
-
setValueInXml
public void setValueInXml(double newValue)Sets the value in xml.- Parameters:
newValue- the new value in xml
-
setFromString
Sets the from string.- Parameters:
newValue- the new from string- Throws:
Exception- the exception
-
isObjectRegistered
Checks if is object registered.- Parameters:
object- the objectfieldName- the field name- Returns:
- true, if is object registered
-
translateType
Translate type.- Parameters:
type- the type- Returns:
- the string
-
getXML
public org.jdom2.Element getXML()Gets the xml.- Returns:
- the xml
-
isAutoGenerated
public boolean isAutoGenerated()Checks if is auto generated.- Returns:
- true, if is auto generated
-
getParamType
Gets the param type.- Returns:
- the param type
-
setParamType
Sets the param type.- Parameters:
paramType- the new param type
-
setMinMax
public void setMinMax(double min, double max)Sets the min max.- Parameters:
min- the minmax- the max
-
getMin
public double getMin()Gets the min.- Returns:
- the min
-
getMax
public double getMax()Gets the max.- Returns:
- the max
-
isMakeExternal
public boolean isMakeExternal()Checks if is make external.- Returns:
- true, if is make external
-
setMakeExternal
public void setMakeExternal(boolean makeExternal)Sets the make external.- Parameters:
makeExternal- the new make external
-
toString
To string. -
getClone
-