org.foray.ps
Class PsInteger

java.lang.Object
  extended by org.foray.ps.PsNumber
      extended by org.foray.ps.PsInteger
All Implemented Interfaces:
Cloneable, Comparable<PsNumber>, PsObject, PsObjectSimple

public class PsInteger
extends PsNumber

Class representing a numeric PostScript object.


Field Summary
static int PS_LARGEST_INTEGER
          Constant indicating the largest PostScript integer value.
static int PS_SMALLEST_INTEGER
          Constant indicating the smallest PostScript integer value.
 
Constructor Summary
PsInteger(BigDecimal value)
          Constructor for a BigDecimal parameter.
PsInteger(int value)
          Constructor for an int parameter.
 
Method Summary
 PsInteger clone()
           
static PsInteger create(PsInterpreter4a interpreter, byte[] input)
          Static method to attempt to create a PSInteger instance, if the input qualifies.
 PsInteger duplicate()
          This is a shallow copy.
 PsName getTypeName()
          Needed for the "type" operator.
 int intValue()
          Returns the integer value of this instance.
 boolean isComposite()
          The method should be overridden by composite objects.
 boolean isExecutable()
          Indicates whether this object is executable.
static PsNumber makePSNumber(long value)
          Creates a PSInteger if value is within the PostScript architectural limits for an integer.
 String toString()
           
 
Methods inherited from class org.foray.ps.PsNumber
add, compareTo, divide, equals, getDoubleValue, getFloatValue, getValue, isAlphabetic, isComparable, isMember, isNumeral, multiply, negate, round, subtract
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PS_SMALLEST_INTEGER

public static final int PS_SMALLEST_INTEGER
Constant indicating the smallest PostScript integer value.

See Also:
Constant Field Values

PS_LARGEST_INTEGER

public static final int PS_LARGEST_INTEGER
Constant indicating the largest PostScript integer value.

See Also:
Constant Field Values
Constructor Detail

PsInteger

public PsInteger(int value)
Constructor for an int parameter.

Parameters:
value - The value to encapsulate.

PsInteger

public PsInteger(BigDecimal value)
Constructor for a BigDecimal parameter.

Parameters:
value - The value to encapsulate. This must be a BigDecimal that has no fractional part, that is, it must be an integer.
Method Detail

makePSNumber

public static PsNumber makePSNumber(long value)
Creates a PSInteger if value is within the PostScript architectural limits for an integer.

Parameters:
value - The value to be encapsulated.
Returns:
A PSInteger instance if value is within the PS architectural limits, or a PSReal instance otherwise.

clone

public PsInteger clone()
Specified by:
clone in class PsNumber

create

public static PsInteger create(PsInterpreter4a interpreter,
                               byte[] input)
Static method to attempt to create a PSInteger instance, if the input qualifies.

Parameters:
interpreter - The parent interpreter.
input - The byte array containing the content to be converted to a PSInteger instance.
Returns:
A PSInteger instance, if the input qualifies, otherwise, null.

duplicate

public PsInteger duplicate()
Description copied from interface: PsObject
This is a shallow copy. Specifically, composite objects should generally return themselves. Simple objects should return copies of themselves.

Returns:
A duplicate of this that conforms to what is expected by the "dup" operator.

isExecutable

public boolean isExecutable()
Description copied from interface: PsObject
Indicates whether this object is executable.

Returns:
True iff this object is executable.

getTypeName

public PsName getTypeName()
Description copied from interface: PsObject
Needed for the "type" operator.

Returns:
The type name as defined in PSRM2, Chapter 8, "type" operator.

toString

public String toString()
Overrides:
toString in class Object

isComposite

public boolean isComposite()
Description copied from interface: PsObject
The method should be overridden by composite objects.

Returns:
True iff this object is a composite PostScript object.

intValue

public int intValue()
Returns the integer value of this instance.

Returns:
The integer value.


Copyright © 2017. All rights reserved.