JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.page
Class JCUnit.Measure

java.lang.Object
  |
  +--com.klg.jclass.page.JCUnit.Measure
All Implemented Interfaces:
Cloneable
Enclosing class:
JCUnit

public static class JCUnit.Measure
extends Object
implements Cloneable

Measure encapsulates a linear distance with its units of measurement.


Field Summary
 double distance
          The magnitude of the distance being represented.
 com.klg.jclass.page.JCUnit units
          JCUnit object representing the units of linear measurement.
 
Constructor Summary
JCUnit.Measure()
          Creates a new measure using the current default units (magnitude 0).
JCUnit.Measure(double distance)
          Creates a new measure given a distance in the default units.
JCUnit.Measure(com.klg.jclass.page.JCUnit units)
          Creates a new measure using the given units (magnitude 0).
JCUnit.Measure(com.klg.jclass.page.JCUnit units, double distance)
          Creates a new measure given a distance and its units of measurement.
 
Method Summary
 void add(JCUnit.Measure dist)
          Adds a given measure to the current measure.
 void assign(JCUnit.Measure newValue)
          Sets this measure equal to the given one.
 Object clone()
          Creates a clone of this Measure.
 void divide(double factor)
          Divides this measure by a given factor.
 boolean equals(Object obj)
          Tests the equality of an object to this Measure.
 double getAs(com.klg.jclass.page.JCUnit new_units)
          Gets the represented distance in different units.
 boolean greaterThan(JCUnit.Measure measure)
          Compares another measure to this one.
 int hashCode()
          Creates a hash that generates the same value depending on the property values.
 double internal()
          Gets the distance specified by this measure in internal units.
 boolean isNegative()
          Determines if this measure is less than zero.
 boolean isZero()
          Determines if this measure is equal to zero.
 boolean lessThan(JCUnit.Measure measure)
          Compares another measure to this one.
 void multiply(double factor)
          Multiplies this measure by a given factor.
 void subtract(JCUnit.Measure dist)
          Subtracts a given measure from the current measure.
 String toString()
          Returns the distance and units as a String.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

units

public com.klg.jclass.page.JCUnit units
JCUnit object representing the units of linear measurement.


distance

public double distance
The magnitude of the distance being represented.

Constructor Detail

JCUnit.Measure

public JCUnit.Measure()
Creates a new measure using the current default units (magnitude 0).


JCUnit.Measure

public JCUnit.Measure(com.klg.jclass.page.JCUnit units)
Creates a new measure using the given units (magnitude 0).

Parameters:
units - the units which define the distance represented

JCUnit.Measure

public JCUnit.Measure(double distance)
Creates a new measure given a distance in the default units.

Parameters:
distance - a length measured in the current default units

JCUnit.Measure

public JCUnit.Measure(com.klg.jclass.page.JCUnit units,
                      double distance)
Creates a new measure given a distance and its units of measurement.

Parameters:
units - the units in which the length is computed
distance - a length measured in the given units
Method Detail

toString

public String toString()
Returns the distance and units as a String.

Overrides:
toString in class Object
Returns:
distance and units

clone

public Object clone()
Creates a clone of this Measure.

Overrides:
clone in class Object
Returns:
a new Measure, which is a clone

getAs

public double getAs(com.klg.jclass.page.JCUnit new_units)
Gets the represented distance in different units.

Parameters:
new_units - units in which to represent the distance
Returns:
distance converted to the new units

internal

public double internal()
Gets the distance specified by this measure in internal units.

Returns:
the distance in internal units

assign

public void assign(JCUnit.Measure newValue)
Sets this measure equal to the given one.

Parameters:
newValue - the value to assign to this measure

add

public void add(JCUnit.Measure dist)
Adds a given measure to the current measure.

Parameters:
dist - a measure whose distance is to be added to this one

subtract

public void subtract(JCUnit.Measure dist)
Subtracts a given measure from the current measure.

Parameters:
dist - a measure to be subtracted from this one

multiply

public void multiply(double factor)
Multiplies this measure by a given factor.

Parameters:
factor - the amount by which to multiply this measure

divide

public void divide(double factor)
Divides this measure by a given factor.

Parameters:
factor - the amount by which to divide this measure

hashCode

public int hashCode()
Creates a hash that generates the same value depending on the property values.

Overrides:
hashCode in class Object
Returns:

equals

public boolean equals(Object obj)
Tests the equality of an object to this Measure.

Overrides:
equals in class Object
Parameters:
obj - an object to compare with this Measure
Returns:
true if both objects are Measures and equal in magnitude

greaterThan

public boolean greaterThan(JCUnit.Measure measure)
Compares another measure to this one.

Parameters:
measure - a measure to compare for size with this one
Returns:
true if this measure is larger than the given one

lessThan

public boolean lessThan(JCUnit.Measure measure)
Compares another measure to this one.

Parameters:
measure - a measure to compare for size with this one
Returns:
true if this measure is smaller than the given one

isZero

public boolean isZero()
Determines if this measure is equal to zero.

Returns:
true if this measure has zero magnitude

isNegative

public boolean isNegative()
Determines if this measure is less than zero.

Returns:
true if this measure has negative magnitude

Copyright © 2004 Quest Software Inc..
All rights reserved.