org.foray.ps
Class PsName

java.lang.Object
  extended by org.foray.ps.PsName
All Implemented Interfaces:
PsObject, PsObjectSimple

public class PsName
extends Object
implements PsObjectSimple

Class representing a name PostScript object.


Constructor Summary
PsName(String value, boolean executable, boolean immediatelyEvaluated)
          Constructor.
 
Method Summary
static PsName create(PsInterpreter4a interpreter, byte[] input)
          Static method to attempt to create a PsName instance, if the input qualifies.
 PsObject duplicate()
          This is a shallow copy.
 boolean equals(Object anObject)
           
 PsName getTypeName()
          Needed for the "type" operator.
 String getValue()
          Returns the value.
 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 setExecutable(boolean newExecutable)
          Sets the executable status of this name.
 int size()
          Return the size of this name.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PsName

public PsName(String value,
              boolean executable,
              boolean immediatelyEvaluated)
Constructor.

Parameters:
value - The value to encapsulate.
executable - Set to true if this object is executable.
immediatelyEvaluated - Set to true if this name should be evaluated immediately.
Method Detail

create

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

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

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.

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

equals

public boolean equals(Object anObject)
Overrides:
equals in class Object

isExecutable

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

Specified by:
isExecutable in interface PsObject
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.

Specified by:
isComparable in interface PsObject
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.

Specified by:
getTypeName in interface PsObject
Returns:
The type name as defined in PSRM2, Chapter 8, "type" operator.

size

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

Returns:
The size of this name.

toString

public String toString()
Overrides:
toString in class Object

getValue

public String getValue()
Returns the value.

Returns:
The value.

setExecutable

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

Parameters:
newExecutable - The new executable status of this name. Set to true to make it executable, set it to false to make it not executable.

isComposite

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

Specified by:
isComposite in interface PsObject
Returns:
True iff this object is a composite PostScript object.


Copyright © 2017. All rights reserved.