org.foray.ps
Class PsArray

java.lang.Object
  extended by org.foray.ps.PsObjectComposite
      extended by org.foray.ps.PsArray
All Implemented Interfaces:
PsObject
Direct Known Subclasses:
PsColorSpace, PsMatrix

public class PsArray
extends PsObjectComposite

A PostScript array.


Constructor Summary
PsArray(Object[] value, boolean executable)
          Constructor.
 
Method Summary
 PsMatrix convertToMatrix()
          Attempts to convert this into a PsMatrix instance.
 PsObject duplicate()
          This is a shallow copy.
 PsObject get(int index)
          Return one item from the array.
 PsName getTypeName()
          Needed for the "type" operator.
 boolean isComparable(PsObject object)
          Test the comparability of two PSObjects.
 boolean isComposite()
          The method should be overridden by composite objects.
 boolean isExecutable()
          Indicates whether this object is executable.
 void set(int index, Object object)
          Sets the value of one item in the array.
 void setExecutable(boolean executable)
          Sets the executable status of this array.
 int size()
          Return the size of this array.
 
Methods inherited from class org.foray.ps.PsObjectComposite
getAccess, setAccess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PsArray

public PsArray(Object[] value,
               boolean executable)
Constructor.

Parameters:
value - The value to encapsulate.
executable - Set to true if this object is executable.
Method Detail

duplicate

public PsObject 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.

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.

isExecutable

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

Returns:
True iff this object is executable.

isComparable

public boolean isComparable(PsObject object)
Description copied from interface: PsObject
Test the comparability of two PSObjects. Used in the eq, ne, lt, etc. operators.

Parameters:
object - The object that should be tested for comparability.
Returns:
True if this is comparable to object, false otherwise.

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.

size

public int size()
Return the size of this array.

Returns:
The size of this array.

get

public PsObject get(int index)
Return one item from the array.

Parameters:
index - The index to the array item.
Returns:
The requested array item.

set

public void set(int index,
                Object object)
Sets the value of one item in the array.

Parameters:
index - The index to the array item.
object - The object which should be set at the array location for index.

convertToMatrix

public PsMatrix convertToMatrix()
Attempts to convert this into a PsMatrix instance.

Returns:
A new PsMatrix instance made from this, or null if not possible.

setExecutable

public void setExecutable(boolean executable)
Sets the executable status of this array.

Parameters:
executable - The status to set.


Copyright © 2017. All rights reserved.