org.extex.core.glue
Class GlueComponentConstant

java.lang.Object
  extended by org.extex.core.glue.GlueComponentConstant
All Implemented Interfaces:
java.io.Serializable, FixedGlueComponent
Direct Known Subclasses:
GlueComponent

public class GlueComponentConstant
extends java.lang.Object
implements java.io.Serializable, FixedGlueComponent

This class provides a means to store floating numbers with an order.

Examples

 123 pt
 -123 pt
 123.456 pt
 123.pt
 .465 pt
 -.456pt
 +456pt
 

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

Field Summary
static long ONE
          The constant ONE contains the internal representation for 1pt.
protected  byte order
          The field order contains the order of infinity.
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
GlueComponentConstant()
          Creates a new object.
GlueComponentConstant(FixedGlueComponent component)
          Creates a new object with a fixed width.
GlueComponentConstant(long theValue)
          Creates a new object with a fixed width.
GlueComponentConstant(long theValue, byte theOrder)
          Creates a new object with a width with a possibly higher order.
 
Method Summary
 FixedGlueComponent copy()
          Create a copy of this instance with the same order and value.
 boolean eq(FixedGlueComponent d)
          Compares the current instance with another GlueComponent for equality.
 boolean ge(FixedGlueComponent d)
          Compares the current instance with another GlueComponent.
 byte getOrder()
          Getter for order.
 long getValue()
          Getter for the value in scaled points (sp).
 boolean gt(FixedGlueComponent d)
          Compares the current instance with another GlueComponent.
 boolean le(FixedGlueComponent d)
          Compares the current instance with another GlueComponent.
 boolean lt(FixedGlueComponent d)
          Compares the current instance with another GlueComponent.
 boolean ne(FixedGlueComponent 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

ONE

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

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

serialVersionUID

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

See Also:
Constant Field Values

order

protected byte order
The field order contains the order of infinity. In case of an order 0 the value holds the absolute value; otherwise value holds the factor of the order.


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

GlueComponentConstant

public GlueComponentConstant()
Creates a new object.


GlueComponentConstant

public GlueComponentConstant(FixedGlueComponent component)
Creates a new object with a fixed width.

Parameters:
component - the fixed value

GlueComponentConstant

public GlueComponentConstant(long theValue)
Creates a new object with a fixed width.

Parameters:
theValue - the fixed value

GlueComponentConstant

public GlueComponentConstant(long theValue,
                             byte theOrder)
Creates a new object with a width with a possibly higher order.

Parameters:
theValue - the fixed width or the factor
theOrder - the order
Method Detail

copy

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

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

eq

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

Specified by:
eq in interface FixedGlueComponent
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(FixedGlueComponent d)
Compares the current instance with another GlueComponent.

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

getOrder

public byte getOrder()
Getter for order.

Specified by:
getOrder in interface FixedGlueComponent
Returns:
the order.
See Also:
FixedGlueComponent.getOrder()

getValue

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

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

gt

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

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

le

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

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

lt

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

Specified by:
lt in interface FixedGlueComponent
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(FixedGlueComponent d)
Compares the current instance with another GlueComponent for equality.

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

toString

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

Specified by:
toString in interface FixedGlueComponent
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 FixedGlueComponent
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)