com.etymon.pj.object
Class PjNumber

java.lang.Object
  extended by com.etymon.pj.object.BaseObject
      extended by com.etymon.pj.object.PjObject
          extended by com.etymon.pj.object.PjNumber
All Implemented Interfaces:
java.lang.Cloneable

public class PjNumber
extends PjObject

A representation of the PDF number type.


Field Summary
private  float _f
           
static PjNumber ONE
           
static PjNumber TWO
           
static PjNumber ZERO
           
 
Constructor Summary
PjNumber(float f)
          Creates a number object.
 
Method Summary
 java.lang.Object clone()
          Returns a deep copy of this object.
 boolean equals(java.lang.Object obj)
          Compares two PjNumber objects for equality.
 float getFloat()
          Returns the floating point value of this object.
 int getInt()
          Returns the integer value of this object.
 long getLong()
          Returns the long value of this object.
 int hashCode()
          Returns a hash code value for the object.
 boolean isInteger()
          Determines whether this number is an integer.
 long writePdf(java.io.OutputStream os)
          Writes this number object to a stream in PDF format.
 
Methods inherited from class com.etymon.pj.object.PjObject
renumber
 
Methods inherited from class com.etymon.pj.object.BaseObject
toString, write, write, write, writeln
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final PjNumber ZERO

ONE

public static final PjNumber ONE

TWO

public static final PjNumber TWO

_f

private float _f
Constructor Detail

PjNumber

public PjNumber(float f)
Creates a number object.

Parameters:
f - the numeric value to initialize this object to.
Method Detail

getFloat

public float getFloat()
Returns the floating point value of this object.

Returns:
the floating point value of this object.

getInt

public int getInt()
Returns the integer value of this object.

Returns:
the integer value of this object.

getLong

public long getLong()
Returns the long value of this object.

Returns:
the long value of this object.

isInteger

public boolean isInteger()
Determines whether this number is an integer.

Returns:
true if this number has no fractions.

writePdf

public long writePdf(java.io.OutputStream os)
              throws java.io.IOException
Writes this number object to a stream in PDF format.

Specified by:
writePdf in class BaseObject
Parameters:
os - the stream to write to.
Returns:
the number of bytes written.
Throws:
java.io.IOException - if an I/O error occurs.

clone

public java.lang.Object clone()
Returns a deep copy of this object.

Specified by:
clone in class BaseObject
Returns:
a deep copy of this object.

equals

public boolean equals(java.lang.Object obj)
Compares two PjNumber objects for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object to compare to.
Returns:
true if this object is the same as obj, false otherwise.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode value for this object.