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

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

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

Classify stream into 3 categories: GOOD, AVERAGE and POOR, according to the participation of members.

Author:
Shaoxuan Zhang
See Also:
Serialized Form

Field Summary
static java.lang.String name
          Name of this classifier.
 
Constructor Summary
StreamParticipationClassifier(double memberPercentage, double thresholdValue, double frequencyPercentage, 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 getFrequencyPercentage()
           
 double getMemberPercentage()
           
 java.lang.String getName()
           
 PortfolioCategory getStreamCategory(MiniBarChart chart)
          Parse the given MiniBarChart and produce a StreamCategory result.
 double getThresholdValue()
           
 PortfolioCategory getValueCategory(double value)
          Return the category of the given value.
 void saveSetting(Measures.Measure measure)
          Save classifier's setting into the given Measures.Measure instance.
 void setFrequencyPercentage(double frequencyPercentage)
           
 void setMemberPercentage(double memberPercentage)
           
 void setThresholdValue(double thresholdValue)
           
 
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

StreamParticipationClassifier

public StreamParticipationClassifier(double memberPercentage,
                                     double thresholdValue,
                                     double frequencyPercentage,
                                     boolean scaleWithGranularity)
Parameters:
memberPercentage - the memberPercentage to set.
thresholdValue - the thresholdValue to set.
frequencyPercentage - the frequencyPercentage to set.
scaleWithGranularity - the scaleWithGranularity to set.
Method Detail

getStreamCategory

public PortfolioCategory getStreamCategory(MiniBarChart chart)
Parse the given MiniBarChart and produce a StreamCategory result. If there are more than memberPercentage members who contribute value higher than thresholdValue in more than frequencyPercentage of time, the stream will be consider as GOOD. If there are not enough active members to get a GOOD, but the merged stream satisfies the GOOD criteria except member percentage, the stream will be considered as AVERAGE. Otherwise, it will consider as POOR.

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

setMemberPercentage

public void setMemberPercentage(double memberPercentage)
Parameters:
memberPercentage - the memberPercentage to set

getMemberPercentage

public double getMemberPercentage()
Returns:
the memberPercentage

setThresholdValue

public void setThresholdValue(double thresholdValue)
Parameters:
thresholdValue - the thresholdValue to set

getThresholdValue

public double getThresholdValue()
Returns:
the thresholdValue

setFrequencyPercentage

public void setFrequencyPercentage(double frequencyPercentage)
Parameters:
frequencyPercentage - the frequencyPercentage to set

getFrequencyPercentage

public double getFrequencyPercentage()
Returns:
the frequencyPercentage

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 the value < 0, NA will be return. Otherwise, always return OTHER.

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

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