|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.stanford.hci.r3.units.Units
public abstract class Units
Allows fluid conversion between length measurements in different units.
This software is distributed under the BSD License.
Field Summary | |
---|---|
static double |
POINTS_PER_INCH
Java handles everything in 1/72nd of an inch (1 point). |
Constructor Summary | |
---|---|
protected |
Units(double val)
The only time you can set the value. |
|
Units(double val,
java.lang.String name)
Used when you want to create (and name) an anonymous unit. |
Method Summary | |
---|---|
static Units |
add(Units a,
Units b)
|
protected Units |
clone()
|
boolean |
equals(java.lang.Object o)
Check if the lengths match. |
double |
getConversionTo(Units destUnits)
|
Units |
getCopy()
Returns a copy of this unit. |
protected abstract double |
getNumberOfUnitsInOneInch()
|
java.lang.String |
getUnitName()
|
Units |
getUnitsObjectOfSameLengthIn(Units destUnits)
Gets a new Units object of the same type as destUnits, with the same physical length as this object. |
Units |
getUnitsObjectOfSameTypeWithValue(double val)
Gets a new Units object of the same type as this unit, but with a new value. |
double |
getValue()
|
double |
getValueIn(Units destUnits)
Gets the value in a new unit. |
double |
getValueInCentimeters()
|
double |
getValueInInches()
This is a CONVENIENCE method. |
double |
getValueInMillimeters()
|
double |
getValueInPatternDots()
CONVENIENCE method for converting this unit to PatternDots. |
double |
getValueInPixels()
CONVENIENCE method for converting to Pixels. |
double |
getValueInPoints()
CONVENIENCE method for converting this unit to Points. |
static Units |
subtract(Units a,
Units b)
|
Inches |
toInches()
Get an Inches object representing the same physical length. |
Pixels |
toPixels()
|
Points |
toPoints()
Get a Points object representing the same physical length. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final double POINTS_PER_INCH
Constructor Detail |
---|
protected Units(double val)
val
- public Units(double val, java.lang.String name)
val
- name
- Method Detail |
---|
public static Units add(Units a, Units b)
a
- b
-
public static Units subtract(Units a, Units b)
a
- b
-
protected Units clone()
clone
in class java.lang.Object
Object.clone()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public double getConversionTo(Units destUnits)
destUnits
-
public Units getCopy()
protected abstract double getNumberOfUnitsInOneInch()
public java.lang.String getUnitName()
public Units getUnitsObjectOfSameLengthIn(Units destUnits)
destUnits
-
public Units getUnitsObjectOfSameTypeWithValue(double val)
val
-
public double getValue()
public double getValueIn(Units destUnits)
destUnits
-
public double getValueInCentimeters()
public double getValueInInches()
public double getValueInMillimeters()
public double getValueInPatternDots()
public double getValueInPixels()
public double getValueInPoints()
public Inches toInches()
public Pixels toPixels()
public Points toPoints()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
|
Copyright 2006 Stanford University | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |