org.sourceforge.espro.elicitation
Class ScalePointSet

java.lang.Object
  extended by org.sourceforge.espro.elicitation.ScalePointSet

public class ScalePointSet
extends java.lang.Object

ScalePointSet is a set of points on a scale. This is how you can create you own scale by just calculating the scale points.

Version:
2.0
Author:
(c) 2007 Martin Kaffanke
See Also:
ScalePoint

Constructor Summary
ScalePointSet()
           
 
Method Summary
 void add(double distance, double size)
          Adds a scale point (withouth a label).
 void add(double distance, double size, double label)
          Adds a scale point with a label.
 int count()
          Counts the number of points in the set.
 org.sourceforge.espro.elicitation.ScalePoint get(int i)
          Returns a ScalePoint from the list by the given position.
 double getMax()
          Returns the max.
 double getMin()
          Returns the min.
 double getRange()
          Returns the range.
 org.sourceforge.espro.elicitation.ScalePoint getScaled(int i)
          Returns a scaled ScalePoint.
 double getScaledDist(int pos)
          Returns only the scaled dist.
 double graphicsToValue(double pointer)
          Descales a value to the scale.
 double scale(org.sourceforge.espro.elicitation.ScalePoint p)
          Tells the ScalePointSet to scale the ScalePoint.
 void setRange(double range)
          Sets the range
 double valueToGraphics(double value)
          Scales a real value to the scale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScalePointSet

public ScalePointSet()
Method Detail

add

public void add(double distance,
                double size)
Adds a scale point (withouth a label).

Parameters:
distance - The distance to the base of the scale.
size - The size of the line.

add

public void add(double distance,
                double size,
                double label)
Adds a scale point with a label.

Parameters:
distance - The distance to the base of the scale.
size - The size of the line.
label - The label to use with this scale point.

count

public int count()
Counts the number of points in the set.

Returns:
The number of points in the set.

get

public org.sourceforge.espro.elicitation.ScalePoint get(int i)
Returns a ScalePoint from the list by the given position.

Parameters:
i - The position in the list. (Start with 0)
Returns:
The ScalePoint

getMax

public double getMax()
Returns the max.

Returns:
The max.

getMin

public double getMin()
Returns the min.

Returns:
The min.

getRange

public double getRange()
Returns the range.

Returns:
The range.

getScaled

public org.sourceforge.espro.elicitation.ScalePoint getScaled(int i)
Returns a scaled ScalePoint. This first scales the scale point and returns it then.

Parameters:
i - The position of the scale point (starting by 0)
Returns:
The scaled ScalePoint.
See Also:
getScaledDist(int)

getScaledDist

public double getScaledDist(int pos)
Returns only the scaled dist.

Parameters:
pos - The position of the scale point.
Returns:
The distance of the scale point.
See Also:
getScaled(int)

graphicsToValue

public double graphicsToValue(double pointer)
Descales a value to the scale. Calculates the value of the Scale from the given position on the scale. The position is the real position on the scale, lets say you have an area (height) of 300 points (on the screen) for the scale, and the scale goes from 0 to 1. So you put 200 points in there the real value on the scale is 0.666. This method calculates the 0.666 from the given 200.

Parameters:
pointer - The position of the scale.
Returns:
The real scale value.
See Also:
valueToGraphics(double)

scale

public double scale(org.sourceforge.espro.elicitation.ScalePoint p)
Tells the ScalePointSet to scale the ScalePoint.

Parameters:
p - The ScalePoint
Returns:
The scaled distance.

setRange

public void setRange(double range)
Sets the range

Parameters:
range - The range to set.

valueToGraphics

public double valueToGraphics(double value)
Scales a real value to the scale. For more information see graphicsToValue(double).

Parameters:
value - The real value inside the scale.
Returns:
The position on the scale.