operators
Class PSCurrentpoint

java.lang.Object
  extended byoperators.PSCurrentpoint
All Implemented Interfaces:
pstypes.PSObject, pstypes.PSOperator, pstypes.PSPathOperator

public class PSCurrentpoint
extends java.lang.Object
implements pstypes.PSPathOperator

Implements PSPathOperator interface.

Methods such as getOperatorToken() are inherited from PSPathOperator interface which, in turn, are inherited from PSOperator. This concrete class is responsible for putting the current point coordinated on top of the stack, if there is a current point.


Constructor Summary
PSCurrentpoint()
           
 
Method Summary
 void action(dtypes.PSStack s, dtypes.PSPath p)
          Adds the current point on top of the Runtime Stack.
 java.lang.String getOperatorToken()
          Returns the token identifying this operator.
 boolean isValid(dtypes.PSStack s)
          Checks if it valid to use this operator now.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSCurrentpoint

public PSCurrentpoint()
Method Detail

getOperatorToken

public java.lang.String getOperatorToken()
Returns the token identifying this operator.

Returns the name of the operand that this concrete class simulates, here "currentpoint".

Precondition : A valid operator class has been created.
Postcondition : A string is returned, labeling the semantics of this class.

Specified by:
getOperatorToken in interface pstypes.PSOperator
Returns:
The token identifying this operator.

isValid

public boolean isValid(dtypes.PSStack s)
                throws exceptions.PSSyntaxException
Checks if it valid to use this operator now.

The current position must not be null.

Precondition : A valid instance of PSStack is given and the current position is not null.
Postcondition : A reply to the question whether the operator can perfom its defined behaviour.

Specified by:
isValid in interface pstypes.PSOperator
Parameters:
s - A reference to an instance of PSStack.
Returns:
True if the operation can be executed, false otherwise.
Throws:
exceptions.PSSyntaxException - The syntax of the token is wrong.

action

public void action(dtypes.PSStack s,
                   dtypes.PSPath p)
Adds the current point on top of the Runtime Stack.

Precondition : A valid Runtime Stack and Graphics Stack are given to method.
Postcondition : First x and then y will be pushed in the Runtime Stack.

Specified by:
action in interface pstypes.PSPathOperator
Parameters:
s - The Runtime Stack which will hold the coordinates.
p - The Graphics Stack.