com.exponto.jstock.indicators
Class SingleParameterParameters

java.lang.Object
  extended bycom.exponto.jstock.indicators.IndicatorParameters
      extended bycom.exponto.jstock.indicators.SingleParameterParameters
All Implemented Interfaces:
IndicatorParametersInterface

public class SingleParameterParameters
extends IndicatorParameters

Contains Moving Average specific parameters used in computation of an indicator series. It may also be used by related indicators using the same kind of parameters. Parameter name (for properties file) may be specified in the Constructor.

Author:
kaare

Field Summary
 
Fields inherited from class com.exponto.jstock.indicators.IndicatorParameters
m_compArray, m_parameterValues, m_validFrom, sm_delimiter, sm_validTo
 
Constructor Summary
SingleParameterParameters(int days, java.lang.String propName, java.lang.String label, java.lang.String toolTipString)
           
SingleParameterParameters(java.lang.String s, java.lang.String propName, java.lang.String label, java.lang.String toolTipString)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          Only checks that the Indicator parameters are equal.
 int[] fromParameterString(java.lang.String s)
          Generates new parameter(s) from a string.
 int getNumberOfDays()
           
 java.lang.String[] getParameterNames()
           
 javax.swing.JComponent[][] getUserInterface()
          Provides the Options menu with components to use for this indicator.
 int hashCode()
          Note: Reach MAXINT after about 7 - 10 parameters depending on the parameter
 boolean indicatorEnabled()
          Checks if the parameters settings of this indicator indicates that the Indicator is activated (e.g.
 void setNumberOfDays(int i)
           
 java.lang.String toParameterString()
          Used to generate a string of the parameter(s) of this instance.
 void updateParameters()
          Used to ensure that indicators parameters are up to date before saving.
 
Methods inherited from class com.exponto.jstock.indicators.IndicatorParameters
getParameters, getValidFrom, getValidTo, setParameters, setParameters, setValidFrom, setValidTo, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SingleParameterParameters

public SingleParameterParameters(java.lang.String s,
                                 java.lang.String propName,
                                 java.lang.String label,
                                 java.lang.String toolTipString)

SingleParameterParameters

public SingleParameterParameters(int days,
                                 java.lang.String propName,
                                 java.lang.String label,
                                 java.lang.String toolTipString)
Method Detail

getParameterNames

public java.lang.String[] getParameterNames()
Specified by:
getParameterNames in class IndicatorParameters

getNumberOfDays

public int getNumberOfDays()
Returns:
the number of days used in the calculation

setNumberOfDays

public void setNumberOfDays(int i)
Parameters:
i - the number of days used in the calculation

getUserInterface

public javax.swing.JComponent[][] getUserInterface()
Description copied from class: IndicatorParameters
Provides the Options menu with components to use for this indicator. The JComponents are responsible for notifying "their" indicator when values are changed, and also update the properties files. Note that the receiving class makes a few assumptions on the content of the array.

Specified by:
getUserInterface in interface IndicatorParametersInterface
Specified by:
getUserInterface in class IndicatorParameters
Returns:
an JComponent array with the components that shall be displayed

indicatorEnabled

public boolean indicatorEnabled()
Description copied from interface: IndicatorParametersInterface
Checks if the parameters settings of this indicator indicates that the Indicator is activated (e.g. number of days used in RSI calcultaion set to a value larger than 0).

Specified by:
indicatorEnabled in interface IndicatorParametersInterface
Specified by:
indicatorEnabled in class IndicatorParameters

updateParameters

public void updateParameters()
Description copied from interface: IndicatorParametersInterface
Used to ensure that indicators parameters are up to date before saving. Typical implementation will read the parameters values from the user interface (JComponent [][]) and set the indicators parameters.

Specified by:
updateParameters in interface IndicatorParametersInterface
Specified by:
updateParameters in class IndicatorParameters

toParameterString

public java.lang.String toParameterString()
Description copied from interface: IndicatorParametersInterface
Used to generate a string of the parameter(s) of this instance. May e.g. be used for persitent storing of the parameters

Returns:
the parameters of the class encoded as a string

fromParameterString

public int[] fromParameterString(java.lang.String s)
Description copied from interface: IndicatorParametersInterface
Generates new parameter(s) from a string. May be used to regenerate parameters stored in db. Also see above.

Parameters:
s - the parameters of the class encoded as a string
Returns:
int [] with the parameter values

hashCode

public int hashCode()
Description copied from class: IndicatorParameters
Note: Reach MAXINT after about 7 - 10 parameters depending on the parameter

Specified by:
hashCode in interface IndicatorParametersInterface
Overrides:
hashCode in class IndicatorParameters

equals

public boolean equals(java.lang.Object o)
Only checks that the Indicator parameters are equal. Does not care about tooltips etc.

Overrides:
equals in class IndicatorParameters


Copyright © 2004 Kaare Ranum