org.extex.core.dimen
Class DimenConstant

java.lang.Object
  extended by org.extex.core.dimen.DimenConstant
All Implemented Interfaces:
java.io.Serializable, FixedDimen
Direct Known Subclasses:
Dimen

public class DimenConstant
extends java.lang.Object
implements FixedDimen, java.io.Serializable

This class provides objects of type Dimen where all assignment methods are nit present. Thus the object is in fact immutable.

Version:
$Revision: 4399 $
Author:
Gerd Neugebauer
See Also:
Serialized Form

Field Summary
static long ONE
          The constant ONE contains the internal representation for 1pt.
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
protected  long value
          The field value contains the integer representation of the dimen register in sp if the order is 0.
 
Constructor Summary
DimenConstant(FixedDimen value)
          Creates a new object.
DimenConstant(long value)
          Creates a new object.
 
Method Summary
 FixedDimen copy()
          Create a copy of this instance with the same order and value.
 boolean eq(FixedDimen d)
          Compares the current instance with another GlueComponent for equality.
 boolean ge(FixedDimen d)
          Compares the current instance with another GlueComponent.
 long getValue()
          Getter for the value in scaled points (sp).
 boolean gt(FixedDimen d)
          Compares the current instance with another GlueComponent.
 boolean le(FixedDimen d)
          Compares the current instance with another GlueComponent.
 boolean lt(FixedDimen d)
          Compares the current instance with another GlueComponent.
 boolean ne(FixedDimen d)
          Compares the current instance with another GlueComponent for equality.
 java.lang.String toString()
          Determine the printable representation of the object.
 void toString(java.lang.StringBuffer sb)
          Determine the printable representation of the object and append it to the given StringBuffer.
 void toString(java.lang.StringBuffer sb, char c1, char c2)
          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

serialVersionUID

protected static final long serialVersionUID
The constant serialVersionUID contains the id for serialization.

See Also:
Constant Field Values

ONE

public static final long ONE
The constant ONE contains the internal representation for 1pt.

See Also:
"TeX – The Program [101]", Constant Field Values

value

protected long value
The field value contains the integer representation of the dimen register in sp if the order is 0. If the order is not 0 then the value holds the factor to the order in units of 216.

Constructor Detail

DimenConstant

public DimenConstant(FixedDimen value)
Creates a new object.

Parameters:
value - the value to be stored

DimenConstant

public DimenConstant(long value)
Creates a new object.

Parameters:
value - the value to be stored
Method Detail

copy

public FixedDimen copy()
Create a copy of this instance with the same order and value.

Specified by:
copy in interface FixedDimen
Returns:
a new copy of this instance

eq

public boolean eq(FixedDimen d)
Compares the current instance with another GlueComponent for equality.

Specified by:
eq in interface FixedDimen
Parameters:
d - the other GlueComponent to compare to. If this parameter is null then the comparison fails.
Returns:
true iff |this| == |d| and ord(this) == ord(d)

ge

public boolean ge(FixedDimen d)
Compares the current instance with another GlueComponent.

Specified by:
ge in interface FixedDimen
Parameters:
d - the other GlueComponent to compare to
Returns:
true iff this is greater or equal to d

getValue

public long getValue()
Getter for the value in scaled points (sp).

Specified by:
getValue in interface FixedDimen
Returns:
the value in internal units of scaled points (sp)

gt

public boolean gt(FixedDimen d)
Compares the current instance with another GlueComponent.

Specified by:
gt in interface FixedDimen
Parameters:
d - the other GlueComponent to compare to
Returns:
true iff |this| > |d|

le

public boolean le(FixedDimen d)
Compares the current instance with another GlueComponent.

Specified by:
le in interface FixedDimen
Parameters:
d - the other GlueComponent to compare to
Returns:
true iff this is less or equal to d

lt

public boolean lt(FixedDimen d)
Compares the current instance with another GlueComponent.

Specified by:
lt in interface FixedDimen
Parameters:
d - the other GlueComponent to compare to
Returns:
true iff ord(this) == ord(d) && |this| < |d| or ord(this) < ord(d)

ne

public boolean ne(FixedDimen d)
Compares the current instance with another GlueComponent for equality.

Specified by:
ne in interface FixedDimen
Parameters:
d - the other GlueComponent to compare to. If this parameter is null then the comparison fails.
Returns:
false iff |this| == |d|

toString

public java.lang.String toString()
Determine the printable representation of the object.

Specified by:
toString in interface FixedDimen
Overrides:
toString in class java.lang.Object
Returns:
the printable representation
See Also:
toString(StringBuffer)

toString

public void toString(java.lang.StringBuffer sb)
Determine the printable representation of the object and append it to the given StringBuffer.

Specified by:
toString in interface FixedDimen
Parameters:
sb - the output string buffer
See Also:
toString()

toString

public void toString(java.lang.StringBuffer sb,
                     char c1,
                     char c2)
Determine the printable representation of the object and append it to the given StringBuffer.

Parameters:
sb - the output string buffer
c1 - the first character for the length of order 0
c2 - the second character for the length of order 0
See Also:
toString(StringBuffer)