|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.extex.core.scaled.ScaledNumber
public class ScaledNumber
This class provides a fixed point number.
| Field Summary | |
|---|---|
static long |
ONE
The constant ONE contains the internal representation for 1pt. |
| Constructor Summary | |
|---|---|
ScaledNumber()
Creates a new object. |
|
ScaledNumber(long value)
Creates a new object. |
|
| Method Summary | |
|---|---|
void |
add(long scaled)
Add a number to the current one. |
void |
add(ScaledNumber scaled)
Add a number to the current one. |
void |
divide(long scaled)
Divide the scaled value by a number. |
boolean |
eq(ScaledNumber d)
Compares the current instance with another ScaledNumber for equality. |
boolean |
ge(ScaledNumber d)
Compares the current instance with another ScaledNumber. |
long |
getValue()
Getter for the value. |
boolean |
le(ScaledNumber d)
Compares the current instance with another ScaledNumber. |
boolean |
lt(ScaledNumber d)
Compares the current instance with another ScaledNumber. |
void |
multiply(long scaled)
Multiply the current value by a scaled number. |
void |
multiply(long nom,
long denom)
Multiply the value by an integer fraction. |
void |
negate()
Negate the current value. |
void |
set(long scaled)
Set the value to a new one |
void |
set(ScaledNumber scaled)
Setter for the value |
void |
subtract(ScaledNumber scaled)
Subtract a number from the current one. |
java.lang.String |
toString()
Determine the printable representation of the object. |
static void |
toString(java.lang.StringBuffer sb,
long value)
Determine the printable representation of the object and append it to the given StringBuffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long ONE
| Constructor Detail |
|---|
public ScaledNumber()
public ScaledNumber(long value)
value - the initial value| Method Detail |
|---|
public static void toString(java.lang.StringBuffer sb,
long value)
sb - the output string buffervalue - the internal value in multiples of ONEpublic void add(long scaled)
scaled - the number to addpublic void add(ScaledNumber scaled)
scaled - the number to addpublic void divide(long scaled)
scaled - the divisorpublic boolean eq(ScaledNumber d)
d - the other ScaledNumber to compare to. If this parameter is
null then the comparison fails.
true iff |this| == |d|public boolean ge(ScaledNumber d)
d - the other ScaledNumber to compare to
true iff this is greater or equal to dpublic long getValue()
public boolean le(ScaledNumber d)
d - the other ScaledNumber to compare to
true iff this is less or equal to dpublic boolean lt(ScaledNumber d)
d - the other ScaledNumber to compare to
true iff |this| < |d|public void multiply(long scaled)
scaled - the multiplicant
public void multiply(long nom,
long denom)
length = length * nom / denom
nom - nominatordenom - denominatorpublic void negate()
public void set(long scaled)
scaled - the new valuepublic void set(ScaledNumber scaled)
scaled - the new valuepublic void subtract(ScaledNumber scaled)
scaled - the number to subtractpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||