org.omegahat.Graphics.Primitives
Class UDouble

java.lang.Object
  |
  +--org.omegahat.Graphics.Primitives.UDouble
Direct Known Subclasses:
InterpretedUDouble, UDoubleExpression

public class UDouble
extends java.lang.Object

Double values with an associated unit, used in specifying RegionDescriptionInts. All the transformation methods map to Normalized Parent Coordinates NPC. These are usually processed by RectRegionInt to map to Normalized Device Coordinates (NDC) when plotting, etc.

See class Unit for the possible units.


Constructor Summary
UDouble()
           
UDouble(double value)
          Specification with no unit type.
UDouble(double value, int unit)
          Specification of value and type.
 
Method Summary
 java.lang.Object addValue(double val, boolean inPlace)
           
 java.lang.Object addValue(double val, int unit, boolean inPlace)
           
 java.lang.Object addValue(java.lang.Object rhs, boolean inPlace)
          Add the specified object to this UDouble
 UDouble createInstance(double val, int unit)
           
 java.lang.Object subtractValue(java.lang.Object value, boolean inPlace)
           
 java.lang.String toString()
           
protected  double transformDimension(ScaleInt s, double thisCM, double otherCM, int fontSize)
          Transform from the current units to Normalized Parent Coordinates (NPC) given the appropriate information from the parent.
 double transformHeight(ScaleInt s, int origin, double widthCM, double heightCM, int fontSize)
          Maps the value of this object to NPC and adjusts for the position of the origin and the potentially different directions for the drawing coordinates.
protected  double transformLocation(ScaleInt s, double thisCM, double otherCM, int fontSize)
          Transform from the current units to Normalized Parent Coordinates (NPC) given the appropriate information from the parent.
 double transformWidth(ScaleInt s, int origin, double widthCM, double heightCM, int fontSize)
           
 double transformX(ScaleInt s, int origin, double widthCM, double heightCM, int fontSize)
          Map the value to parent coordinates and adjust for the location of the origin in the horizontal dimension.
 double transformY(ScaleInt s, int origin, double widthCM, double heightCM, int fontSize)
          Map the value to parent coordinates and adjust for the location of the origin in the vertical dimension.
 int unit()
          Accessor for getting the type of unit.
 int unit(int u)
          Accessor for setting the type of unit.
 double value()
          Accessor for getting the numeric value represented by this object.
 double value(double v)
          Accessor for setting the numeric value represented by this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UDouble

public UDouble(double value)
Specification with no unit type.

UDouble

public UDouble(double value,
               int unit)
Specification of value and type.

UDouble

public UDouble()
Method Detail

unit

public int unit()
Accessor for getting the type of unit.

unit

public int unit(int u)
Accessor for setting the type of unit.

value

public double value()
Accessor for getting the numeric value represented by this object.

value

public double value(double v)
Accessor for setting the numeric value represented by this object.

transformLocation

protected double transformLocation(ScaleInt s,
                                   double thisCM,
                                   double otherCM,
                                   int fontSize)
Transform from the current units to Normalized Parent Coordinates (NPC) given the appropriate information from the parent.
Parameters:
s - the components's scale on which this value should be transformed.
thisCM - the absolute size of the appropriate dimensions (i.e. width or height) component in centimeters.
otherCM - the absolute size of the other dimension for use in square coordinates (SNPC).
fontSize - the size of the component's fonts, in absolute points.

transformX

public double transformX(ScaleInt s,
                         int origin,
                         double widthCM,
                         double heightCM,
                         int fontSize)
Map the value to parent coordinates and adjust for the location of the origin in the horizontal dimension.
Parameters:
s - the components's scale on which this value should be transformed.
thisCM - the absolute size of the appropriate dimensions (i.e. width or height) component in centimeters.
otherCM - the absolute size of the other dimension for use in square coordinates (SNPC).
fontSize - the size of the component's fonts, in absolute points.
See Also:
#transformLocation(ScaleInt, double, double, double)

transformY

public double transformY(ScaleInt s,
                         int origin,
                         double widthCM,
                         double heightCM,
                         int fontSize)
Map the value to parent coordinates and adjust for the location of the origin in the vertical dimension.
Parameters:
s - the components's scale on which this value should be transformed.
thisCM - the absolute size of the appropriate dimensions (i.e. width or height) component in centimeters.
otherCM - the absolute size of the other dimension for use in square coordinates (SNPC).
fontSize - the size of the component's fonts, in absolute points.
See Also:
#transformLocation(ScaleInt, double, double, double)

transformDimension

protected double transformDimension(ScaleInt s,
                                    double thisCM,
                                    double otherCM,
                                    int fontSize)
Transform from the current units to Normalized Parent Coordinates (NPC) given the appropriate information from the parent.
Parameters:
s - the components's scale on which this value should be transformed.
thisCM - the absolute size of the appropriate dimensions (i.e. width or height) component in centimeters.
otherCM - the absolute size of the other dimension for use in square coordinates (SNPC).
fontSize - the size of the component's fonts, in absolute points.

transformWidth

public double transformWidth(ScaleInt s,
                             int origin,
                             double widthCM,
                             double heightCM,
                             int fontSize)
Parameters:
s - the components's scale on which this value should be transformed.
thisCM - the absolute size of the appropriate dimensions (i.e. width or height) component in centimeters.
otherCM - the absolute size of the other dimension for use in square coordinates (SNPC).
fontSize - the size of the component's fonts, in absolute points.

transformHeight

public double transformHeight(ScaleInt s,
                              int origin,
                              double widthCM,
                              double heightCM,
                              int fontSize)
Maps the value of this object to NPC and adjusts for the position of the origin and the potentially different directions for the drawing coordinates.
Parameters:
s - the components's scale on which this value should be transformed.
thisCM - the absolute size of the appropriate dimensions (i.e. width or height) component in centimeters.
otherCM - the absolute size of the other dimension for use in square coordinates (SNPC).
fontSize - the size of the component's fonts, in absolute points.

addValue

public java.lang.Object addValue(java.lang.Object rhs,
                                 boolean inPlace)
Add the specified object to this UDouble

addValue

public java.lang.Object addValue(double val,
                                 boolean inPlace)

addValue

public java.lang.Object addValue(double val,
                                 int unit,
                                 boolean inPlace)

subtractValue

public java.lang.Object subtractValue(java.lang.Object value,
                                      boolean inPlace)

createInstance

public UDouble createInstance(double val,
                              int unit)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object