2.17.2: 2011-06-17

net.sf.basedb.clients.web
Class ExperimentExplorer.AnnotationGroup

java.lang.Object
  extended by net.sf.basedb.clients.web.ExperimentExplorer.AnnotationGroup
All Implemented Interfaces:
Comparable<ExperimentExplorer.AnnotationGroup>
Enclosing class:
ExperimentExplorer

public static class ExperimentExplorer.AnnotationGroup
extends Object
implements Comparable<ExperimentExplorer.AnnotationGroup>

An annotation group contains statistical information about the spot values falling into the group.

Version:
2.0
Author:
nicklas
Last modified
$Date: 2010-01-18 08:31:09 +0100 (Mon, 18 Jan 2010) $

Field Summary
private  Set<?> annotationValues
           
private  String color
           
private  int[] count
           
private  int id
           
private  Map<String,Float> statistics
           
private  float[] sum
           
private  String title
           
 
Constructor Summary
private ExperimentExplorer.AnnotationGroup(int id, Set<T> annotationValues, int channels, Formatter<T> formatter)
           
 
Method Summary
 void addStatistics(String key, float value)
          Add another statisitcal measurement to this group.
 void addValue(int channel, float intensity)
          Add an intensity value to this group.
 int compareTo(ExperimentExplorer.AnnotationGroup o)
           
 Set<?> getAnnotationValues()
          Get all annotation values in this annotation group.
 Color getAwtColor()
          Get the AWT color object that corresponds to the HTML color string.
 String getColor()
          Get a color code for HTML that is as distinct as possible from the color of the other groups.
 int getCount(int channel)
          Get the number of intensity values added to the specified channel.
 int getId()
          The ID of the group.
 float getMean(int channel)
          Get the mean of the intensity values for the given channel.
 float getStatistics(String key)
          Get the sum of all values added with the addStatistics(String, float) method with the given key.
 float getSum(int channel)
          Get the sum of intensities for the specified channel.
 String getTitle()
          Get the title of this annotation group.
 void reset()
          Resets all collected statistics in this group.
 void setColor(String color)
          Sets the color for this annotation group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

private final int id

annotationValues

private final Set<?> annotationValues

title

private final String title

sum

private final float[] sum

count

private final int[] count

statistics

private final Map<String,Float> statistics

color

private String color
Constructor Detail

ExperimentExplorer.AnnotationGroup

private ExperimentExplorer.AnnotationGroup(int id,
                                           Set<T> annotationValues,
                                           int channels,
                                           Formatter<T> formatter)
Method Detail

getId

public int getId()
The ID of the group. The ID is only useful within the objects AnnotationSummary objects lifetime. The first group that is created is given an ID of 1, the second 2, and so on.

Returns:
The ID

getTitle

public String getTitle()
Get the title of this annotation group. The title is created by concatenating all annotation values.

Returns:
The title

getAnnotationValues

public Set<?> getAnnotationValues()
Get all annotation values in this annotation group.

Returns:
A set containing all annotation values

getColor

public String getColor()
Get a color code for HTML that is as distinct as possible from the color of the other groups. The colors may repeat if there are many groups.

Returns:
The color string

getAwtColor

public Color getAwtColor()
Get the AWT color object that corresponds to the HTML color string. The color string must have been set with a seven-character string with 2 hex characters for every color component, eg. '#rrggbb'.

Since:
2.14

setColor

public void setColor(String color)
Sets the color for this annotation group.

Parameters:
color - A HTML color code
Since:
2.14

addValue

public void addValue(int channel,
                     float intensity)
Add an intensity value to this group.

Parameters:
channel - The number of the channel, starting with 1
intensity - The spot's intensity

getSum

public float getSum(int channel)
Get the sum of intensities for the specified channel.

Parameters:
channel - The number of the channel, starting with 1
Returns:
The sum of the intensities
See Also:
addValue(int, float)

getCount

public int getCount(int channel)
Get the number of intensity values added to the specified channel.

Parameters:
channel - The number of the channel, starting with 1
Returns:
The number of values
See Also:
addValue(int, float)

getMean

public float getMean(int channel)
Get the mean of the intensity values for the given channel.

Parameters:
channel - he number of the channel, starting with 1
Returns:
The mean of the values, or NaN if no values has been added
See Also:
addValue(int, float)

addStatistics

public void addStatistics(String key,
                          float value)
Add another statisitcal measurement to this group. All values with the same key are added together and can be retrieved with the getStatistics(String) method.

Parameters:
key - The key for the measurment
value - The value to add

getStatistics

public float getStatistics(String key)
Get the sum of all values added with the addStatistics(String, float) method with the given key.

Parameters:
key - The measurement key
Returns:
The sum of the added values or Float.NaN if no value is found

reset

public void reset()
Resets all collected statistics in this group.

Since:
2.14

compareTo

public int compareTo(ExperimentExplorer.AnnotationGroup o)
Specified by:
compareTo in interface Comparable<ExperimentExplorer.AnnotationGroup>

2.17.2: 2011-06-17