org.extex.core.glue
Class GlueComponent

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

public class GlueComponent
extends GlueComponentConstant

This class provides a means to store floating numbers with an order. If the order is 0 then the length denotes a length in multiples of scaled points. If the order is larger then it denotes some order of infinity.

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 FixedGlueComponent MINUS_ONE_FIL
          The constant MINUS_ONE_FIL contains the value of -1 fil.
static long ONE
          The constant ONE contains the internal representation for 1pt.
static FixedGlueComponent ONE_FI
          The constant ONE_FI contains the value of 1 fi.
static FixedGlueComponent ONE_FIL
          The constant ONE_FIL contains the value of 1 fil.
static FixedGlueComponent ONE_FILL
          The constant ONE_FIL contains the value of 1 fill.
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
static FixedGlueComponent ZERO
          The constant ZERO contains the non-stretchable and non-shrinkable value of 0 pt.
 
Fields inherited from class org.extex.core.glue.GlueComponentConstant
order, value
 
Constructor Summary
GlueComponent()
          Creates a new object.
GlueComponent(FixedDimen component)
          Creates a new object with a fixed width.
GlueComponent(FixedGlueComponent component)
          Creates a new object with a fixed width.
GlueComponent(long value)
          Creates a new object with a fixed width.
GlueComponent(long value, byte order)
          Creates a new object with a width with a possibly higher order.
 
Method Summary
 void add(FixedGlueComponent g)
          Add another GlueCoponent g to this instance.
 FixedGlueComponent copy()
          Create a copy of this instance with the same order and value.
 void multiply(long nom, long denom)
          Multiply the value by an integer fraction.
 void negate()
          Negate the value.
 void set(FixedDimen d)
          Setter for the value and order.
 void set(FixedGlueComponent d)
          Setter for the value and order.
 void set(long theValue)
          Setter for the value in terms of the internal representation.
 void setValue(long val)
          Setter for the value.
 void subtract(FixedGlueComponent g)
          Subtract a Glue component from this glue.
 
Methods inherited from class org.extex.core.glue.GlueComponentConstant
eq, ge, getOrder, getValue, gt, le, lt, ne, toString, toString, toString
 
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

MINUS_ONE_FIL

public static final FixedGlueComponent MINUS_ONE_FIL
The constant MINUS_ONE_FIL contains the value of -1 fil.


ONE_FI

public static final FixedGlueComponent ONE_FI
The constant ONE_FI contains the value of 1 fi.


ONE_FIL

public static final FixedGlueComponent ONE_FIL
The constant ONE_FIL contains the value of 1 fil.


ONE_FILL

public static final FixedGlueComponent ONE_FILL
The constant ONE_FIL contains the value of 1 fill.


serialVersionUID

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

See Also:
Constant Field Values

ZERO

public static final FixedGlueComponent ZERO
The constant ZERO contains the non-stretchable and non-shrinkable value of 0 pt.

Constructor Detail

GlueComponent

public GlueComponent()
Creates a new object.


GlueComponent

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

Parameters:
component - the fixed value

GlueComponent

public GlueComponent(FixedDimen component)
Creates a new object with a fixed width.

Parameters:
component - the fixed value

GlueComponent

public GlueComponent(long value)
Creates a new object with a fixed width.

Parameters:
value - the fixed value

GlueComponent

public GlueComponent(long value,
                     byte order)
Creates a new object with a width with a possibly higher order.

Parameters:
value - the fixed width or the factor
order - the order
Method Detail

add

public void add(FixedGlueComponent g)
Add another GlueCoponent g to this instance. If the order of g is greater than the order of this instance then this operation does not change the value or order at all. If the order of g is less than the order of this instance then the value and order of g are stored in this instance. If the orders agree then the sum of both values is stored in this instance.

Parameters:
g - the GlueCoponent to add

copy

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

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

multiply

public void multiply(long nom,
                     long denom)
Multiply the value by an integer fraction.

length = length * nom / denom

Parameters:
nom - nominator
denom - denominator

negate

public void negate()
Negate the value. This is the same as multiplying with -1.


set

public void set(FixedDimen d)
Setter for the value and order.

Parameters:
d - the new value

set

public void set(FixedGlueComponent d)
Setter for the value and order.

Parameters:
d - the new value

set

public void set(long theValue)
Setter for the value in terms of the internal representation. The order is reset to 0.

Parameters:
theValue - the new value in units of scaled points

setValue

public void setValue(long val)
Setter for the value.

Parameters:
val - the new value in units of scaled points

subtract

public void subtract(FixedGlueComponent g)
Subtract a Glue component from this glue. If the order of the other glue component is the same as the current one then the values are subtracted. Otherwise the greater order determines which glue to use.

Parameters:
g - the GlueCoponent to subtract