org.hackystat.projectbrowser.page.projectportfolio.detailspanel.chart
Class StreamTrendClassifier

java.lang.Object
  extended by org.hackystat.projectbrowser.page.projectportfolio.detailspanel.chart.StreamTrendClassifier
All Implemented Interfaces:
java.io.Serializable, StreamClassifier

public class StreamTrendClassifier
extends java.lang.Object
implements java.io.Serializable, StreamClassifier

Classify stream trend into 4 classes: increasing, decreasing, stable and unstable(other). Monotonous increase line will be considered as increasing. Monotonous decrease line will be considered as decreasing. Exactly flat horizontal line will be considered as stable. Others will be considered as unstable(other). Note: a flat line with a little difference in the middle will be consider as unstable(other).

Author:
Shaoxuan Zhang
See Also:
Serialized Form

Field Summary
static java.lang.String name
          Name of this classifier.
 
Constructor Summary
StreamTrendClassifier(double lowerThreshold, double higherThreshold, boolean higherBetter, boolean scaleWithGranularity)
           
 
Method Summary
 org.apache.wicket.markup.html.panel.Panel getConfigurationPanel(java.lang.String id)
          Return the panel for users to configure this stream trend classifer.
 double getHigherThreshold()
           
 double getLowerThreshold()
           
 java.lang.String getName()
           
 PortfolioCategory getStreamCategory(MiniBarChart chart)
          Parse the given MiniBarChart and produce a PortfolioCategory result.
 PortfolioCategory getValueCategory(double value)
          Return the category of the given value.
 boolean isHigherBetter()
           
 void saveSetting(Measures.Measure measure)
          Save classifier's setting into the given Measures.Measure instance.
 void setHigherBetter(boolean higherBetter)
           
 void setHigherThreshold(double higherThreshold)
           
 void setLowerThreshold(double lowerThreshold)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public static final java.lang.String name
Name of this classifier.

See Also:
Constant Field Values
Constructor Detail

StreamTrendClassifier

public StreamTrendClassifier(double lowerThreshold,
                             double higherThreshold,
                             boolean higherBetter,
                             boolean scaleWithGranularity)
Parameters:
lowerThreshold - the lowerThreshold to set.
higherThreshold - the higherThreshold to set.
higherBetter - the higherBetter to set.
scaleWithGranularity - the scaleWithGranularity to set.
Method Detail

getStreamCategory

public PortfolioCategory getStreamCategory(MiniBarChart chart)
Parse the given MiniBarChart and produce a PortfolioCategory result.

Specified by:
getStreamCategory in interface StreamClassifier
Parameters:
chart - the input chart
Returns:
PortfolioCategory enumeration.

getConfigurationPanel

public org.apache.wicket.markup.html.panel.Panel getConfigurationPanel(java.lang.String id)
Return the panel for users to configure this stream trend classifer. User can customize higher, lower thresholds and if higher is better.

Specified by:
getConfigurationPanel in interface StreamClassifier
Parameters:
id - The Wicket component id.
Returns:
a Panel

getValueCategory

public PortfolioCategory getValueCategory(double value)
Return the category of the given value. If value is higher than higherThreshold, getHighCategory() will be returned. If value is higher than lowerThreshold, getLowCategory() will be returned. Otherwise, will return AVERAGE.

Specified by:
getValueCategory in interface StreamClassifier
Parameters:
value - the given value.
Returns:
a PortfolioCategory result

setHigherBetter

public void setHigherBetter(boolean higherBetter)
Parameters:
higherBetter - the higherBetter to set

isHigherBetter

public boolean isHigherBetter()
Returns:
the higherBetter

setHigherThreshold

public void setHigherThreshold(double higherThreshold)
Parameters:
higherThreshold - the higherThreshold to set

getHigherThreshold

public double getHigherThreshold()
Returns:
the higherThreshold

setLowerThreshold

public void setLowerThreshold(double lowerThreshold)
Parameters:
lowerThreshold - the lowerThreshold to set

getLowerThreshold

public double getLowerThreshold()
Returns:
the lowerThreshold

getName

public java.lang.String getName()
Specified by:
getName in interface StreamClassifier
Returns:
the name of this classifier.

saveSetting

public void saveSetting(Measures.Measure measure)
Save classifier's setting into the given Measures.Measure instance.

Specified by:
saveSetting in interface StreamClassifier
Parameters:
measure - the given Measures.Measure instance