org.extex.core.count
Class Count

java.lang.Object
  extended by org.extex.core.count.CountConstant
      extended by org.extex.core.count.Count
All Implemented Interfaces:
java.io.Serializable, FixedCount

public class Count
extends CountConstant

This class represents a long integer value. It is used for instance as count register.

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

Field Summary
static FixedCount ONE
          The constant ONE contains the count register with the value 1.
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
static FixedCount THOUSAND
          The constant THOUSAND contains the count register with the value 1000.
static FixedCount ZERO
          The constant ZERO contains the count register with the value 0.
 
Fields inherited from class org.extex.core.count.CountConstant
value
 
Constructor Summary
Count()
          Creates a new object.
Count(FixedCount count)
          Creates a new object.
Count(long value)
          Creates a new object.
 
Method Summary
 void add(FixedCount val)
          Add a Count to the value.
 void add(long val)
          Add a long to the value.
 void divide(FixedCount denom)
          Divide the value by a denominator.
 void divide(long denom)
          Divide the value by a long.
 boolean eq(FixedCount count)
          Compare the value for equality.
 boolean ge(FixedCount count)
          Compare the value for a greater or equal value.
 long getValue()
          Getter for the value
 boolean gt(FixedCount count)
          Compare the value for a greater value.
 boolean le(FixedCount count)
          Compare the value for a less or equal value.
 boolean lt(FixedCount count)
          Compare the value for a lesser value.
 void multiply(FixedCount factor)
          Multiply the value with a factor.
 void multiply(long factor)
          Multiply the value with a factor.
 boolean ne(FixedCount count)
          Compare the value for non-equality.
 void set(FixedCount c)
          Setter for the value.
 void set(long l)
          Setter for the value.
 java.lang.String toString()
          Determine the printable representation of the object.
 void toString(java.lang.StringBuffer sb)
          Determine the printable representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ONE

public static final FixedCount ONE
The constant ONE contains the count register with the value 1. This count register is in fact immutable.


serialVersionUID

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

See Also:
Constant Field Values

THOUSAND

public static final FixedCount THOUSAND
The constant THOUSAND contains the count register with the value 1000. This count register is in fact immutable.


ZERO

public static final FixedCount ZERO
The constant ZERO contains the count register with the value 0. This count register is in fact immutable.

Constructor Detail

Count

public Count(FixedCount count)
Creates a new object.

Parameters:
count - the reference to be copied

Count

public Count(long value)
Creates a new object.

Parameters:
value - the value

Count

public Count()
Creates a new object.

Method Detail

add

public void add(long val)
Add a long to the value. This operation modifies the value.

Parameters:
val - the value to add to

add

public void add(FixedCount val)
Add a Count to the value. This operation modifies the value.

Parameters:
val - the value to add to

divide

public void divide(long denom)
            throws java.lang.ArithmeticException
Divide the value by a long. This operation modifies the value.

Parameters:
denom - the denominator to divide by
Throws:
java.lang.ArithmeticException - in case of a division by zero

divide

public void divide(FixedCount denom)
            throws java.lang.ArithmeticException
Divide the value by a denominator. This operation modifies the value.

Parameters:
denom - the denominator to divide by
Throws:
java.lang.ArithmeticException - in case of a division by zero

eq

public boolean eq(FixedCount count)
Compare the value for equality.

Specified by:
eq in interface FixedCount
Overrides:
eq in class CountConstant
Parameters:
count - the count to compare to
Returns:
true iff count has an equal value to the current one
See Also:
FixedCount.eq( org.extex.core.count.FixedCount)

ge

public boolean ge(FixedCount count)
Compare the value for a greater or equal value.

Specified by:
ge in interface FixedCount
Overrides:
ge in class CountConstant
Parameters:
count - the count to compare to
Returns:
true iff count has an value greater or equal to the current one
See Also:
FixedCount.ge( org.extex.core.count.FixedCount)

getValue

public long getValue()
Getter for the value

Specified by:
getValue in interface FixedCount
Overrides:
getValue in class CountConstant
Returns:
the value

gt

public boolean gt(FixedCount count)
Compare the value for a greater value.

Specified by:
gt in interface FixedCount
Overrides:
gt in class CountConstant
Parameters:
count - the count to compare to
Returns:
true iff count has an value greater than the current one
See Also:
FixedCount.gt( org.extex.core.count.FixedCount)

le

public boolean le(FixedCount count)
Compare the value for a less or equal value.

Specified by:
le in interface FixedCount
Overrides:
le in class CountConstant
Parameters:
count - the count to compare to
Returns:
true iff count has an value less or equal to the current one
See Also:
FixedCount.le( org.extex.core.count.FixedCount)

lt

public boolean lt(FixedCount count)
Compare the value for a lesser value.

Specified by:
lt in interface FixedCount
Overrides:
lt in class CountConstant
Parameters:
count - the count to compare to
Returns:
true iff count has an value less than the current one
See Also:
FixedCount.lt( org.extex.core.count.FixedCount)

multiply

public void multiply(long factor)
Multiply the value with a factor. This operation modifies the value.

Parameters:
factor - the factor to multiply with

multiply

public void multiply(FixedCount factor)
Multiply the value with a factor. This operation modifies the value.

Parameters:
factor - the factor to multiply with

ne

public boolean ne(FixedCount count)
Compare the value for non-equality.

Specified by:
ne in interface FixedCount
Overrides:
ne in class CountConstant
Parameters:
count - the count to compare to
Returns:
true iff count has an value not equal to the current one
See Also:
FixedCount.ne( org.extex.core.count.FixedCount)

set

public void set(long l)
Setter for the value.

Parameters:
l - the new value
See Also:
set(FixedCount)

set

public void set(FixedCount c)
Setter for the value.

Parameters:
c - the new value
See Also:
set(long)

toString

public java.lang.String toString()
Determine the printable representation of the object. The value returned is exactly the string which would be produced by TeX to print the Count.

Specified by:
toString in interface FixedCount
Overrides:
toString in class CountConstant
Returns:
the printable representation
See Also:
toString(StringBuffer), CountConstant.toString()

toString

public void toString(java.lang.StringBuffer sb)
Determine the printable representation of the object. The value returned is exactly the string which would be produced by TeX to print the Count.

Specified by:
toString in interface FixedCount
Overrides:
toString in class CountConstant
Parameters:
sb - the target string buffer
See Also:
toString(), CountConstant.toString(java.lang.StringBuffer)