dtypes
Class PSPath

java.lang.Object
  extended bydtypes.PSStack
      extended bydtypes.PSPath

public class PSPath
extends PSStack

Is a subclass of PSStack which represents a Graphics Stack for the postscript interpreter. For this reason, it adds two more fields of type Point, which hold the current position and last move of the pen. Because the action() methods of the path operators need to have access to these fields, the class also provides accessors and transformers for these variables.


Constructor Summary
PSPath()
          Creates a new PSPath and initializes its state.
 
Method Summary
 java.awt.Point getCurrentPosition()
          Returns the currentPosition.
 java.awt.Point getLastMove()
          Returns the lastMove.
 java.lang.Object getObjectAt(int n)
          Returns the object held in the stack at the position given.
 void setCurrentPosition(java.awt.Point currentPosition)
          Changes the current position.
 void setLastMove(java.awt.Point lastMove)
          Changes the last move.
 
Methods inherited from class dtypes.PSStack
getSize, isEmpty, peek, pop, push
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSPath

public PSPath()
Creates a new PSPath and initializes its state.

Postcondition : The new PSPath will be created as a PSStack and will also have its two unique fields set to null.

Method Detail

getCurrentPosition

public java.awt.Point getCurrentPosition()
Returns the currentPosition.

Postcondition : the current position is returned successfully.

Returns:
a Point representing the current position of the pen.

getLastMove

public java.awt.Point getLastMove()
Returns the lastMove.

Postcondition : The last move is returned successfully.

Returns:
a Point representing the the last moving coordinates of the pen.

setCurrentPosition

public void setCurrentPosition(java.awt.Point currentPosition)
Changes the current position.

Precondition : A valid Point object must be given or null.
Postcondition : The currentPosition variable changes to the one given.

Parameters:
currentPosition - The new current position.

setLastMove

public void setLastMove(java.awt.Point lastMove)
Changes the last move.

Precondition : A valid Point object must be given or null.
Postcondition : The lastMove variable changes to the one given.

Parameters:
lastMove - The new last move.

getObjectAt

public java.lang.Object getObjectAt(int n)
Returns the object held in the stack at the position given.

Precondition : A valid integer must be given no more than the size of the stack.
Postcondition : The object held at the stack position given is returned.

Parameters:
n - The position in the stack.
Returns:
The object at the specified position.