UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.satin.interpreter
Class InterpreterImpl

java.lang.Object
  |
  +--edu.berkeley.guir.lib.satin.interpreter.InterpreterImpl
All Implemented Interfaces:
Cloneable, EventFilter, EventListener, Interpreter, SatinConstants, SatinEventFilter, Serializable, StrokeEventFilter, StrokeListener
Direct Known Subclasses:
AbstractSelectInterpreter, CircleSelectInterpreter, DefaultInterpreterImpl, DefaultMultiInterpreterImpl, GestureCommandInterpreterImpl, InterpreterWrapper, LinearizeStrokeInterpreter, LinkInterpreter, MergeStrokeInterpreter, MoveSelectedInterpreter, ResizeSelectedInterpreter, RubineInterpreter, SplitStrokeInterpreter

public abstract class InterpreterImpl
extends Object
implements Interpreter

The superclass for all of the types of interpreters. Interpreters can do two different things: handle and manipulate new strokes, and manipulate old strokes. Interpreters are attached to GraphicalObjects, currently one interpreter per GraphicalObject.

This software is distributed under the Berkeley Software License.

 Revisions:  - SATIN-v1.0-1.0.0, Apr 22 1999, JH
               Created class
             - SATIN-v2.1-1.0.0, Aug 11 2000, JH
               Touched for SATIN release
 

Since:
JDK 1.2
Version:
SATIN-v2.1-1.0.0, Aug 11 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )
See Also:
Serialized Form

Inner classes inherited from class edu.berkeley.guir.lib.satin.SatinConstants
SatinConstants.ObjectPoolAffineTransform, SatinConstants.ObjectPoolPoint2D, SatinConstants.ObjectPoolPolygon2D, SatinConstants.ObjectPoolRectangle2D, SatinConstants.ObjectPoolStringBuffer, SatinConstants.UniqueAffineTransform, SatinConstants.UniquePoint2D, SatinConstants.UniquePolygon2D, SatinConstants.UniqueRectangle2D
 
Fields inherited from interface edu.berkeley.guir.lib.satin.SatinConstants
ABOVE, ALL, BAR, BELOW, clipboard, clprops, cmdqueue, cmdsubsys, CONTAINEDBY, CONTAINS, COORD_ABS, COORD_LOCAL, COORD_REL, DAMAGE_LATER, DAMAGE_NOW, DEBUG_GRAPHICS_OFFSET, DEBUG_STYLE_FILE, DEBUG_STYLE_GPROPERTY, DEEP, DEFAULT_POINT2D_POOL_SIZE, DEFAULT_POLYGON2D_POOL_SIZE, DEFAULT_RECTANGLE_POOL_SIZE, DEFAULT_REPAINT_THRESHOLD, DEFAULT_SELECT_THRESHOLD, DEFAULT_STRINGBUFFER_POOL_SIZE, DEFAULT_TRANSFORM_POOL_SIZE, DIR_CENTER, DIR_DOWN, DIR_DOWN_LEFT, DIR_DOWN_RIGHT, DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_UP_LEFT, DIR_UP_RIGHT, FILTER_THRESHOLD, FIRST, FLOATING_PT_TOLERANCE, glprops, INTERSECTS, KEY_STYLE_DASHARRAY, KEY_STYLE_DASHPHASE, KEY_STYLE_DRAWCOLOR, KEY_STYLE_DRAWFONT, KEY_STYLE_DRAWTRANSPARENCY, KEY_STYLE_ENDCAP, KEY_STYLE_FILLCOLOR, KEY_STYLE_FILLTRANSPARENCY, KEY_STYLE_LINEJOIN, KEY_STYLE_LINEWIDTH, KEY_STYLE_MITERLIMIT, NEAR, NOTIFY_BOUNDS, NOTIFY_LAYER, NOTIFY_LOCATION, NOTIFY_STYLE, NOTIFY_TRANSFORM, poolPoints, poolPolys, poolRects, poolStrbuf, poolTx, rand, SATIN_DATA_DIRECTORY_DEFAULT, SATIN_DATA_DIRECTORY_GPROPERTY, SATIN_PROPERTIES_FILENAME, SHALLOW
 
Constructor Summary
InterpreterImpl()
          Empty constructor.
 
Method Summary
abstract  Object clone()
          Since not overriding clone() can cause many errors with copying-and-pasting, I'm forcing you to do it.
protected  InterpreterImpl clone(InterpreterImpl intrp)
           
 GraphicalObject getAttachedGraphicalObject()
          Get the GraphicalObject this Interpreter is attached to.
 String getName()
          Get the name of this Interpreter.
 void handleNewStroke(NewStrokeEvent evt)
          By default, does nothing.
 void handleSingleStroke(SingleStrokeEvent evt)
          By default, does nothing.
 void handleUpdateStroke(UpdateStrokeEvent evt)
          By default, does nothing.
 boolean isConsumedAccepted()
          Check whether consumed events are accepted or not.
 boolean isEnabled()
          See if this interpreter is enabled or not (ie can run or not).
 boolean isEventAccepted(EventObject evt)
          This method is called for us when an event is handed to us, to ensure that we really want to handle the event.
 boolean isEventAccepted(StrokeEvent evt)
          This method is called for us when an event is handed to us, to ensure that we really want to handle the event.
 boolean isLeftButtonAccepted()
          Check if the left button is Accepted.
 boolean isMiddleButtonAccepted()
          Check if the middle button is Accepted.
 boolean isRightButtonAccepted()
          Check if the right button is Accepted.
 void setAcceptConsumed(boolean flag)
          Set whether consumed events are accepted or not.
 void setAcceptLeftButton(boolean flag)
          Set whether the left button is Accepted or not.
 void setAcceptMiddleButton(boolean flag)
          Set whether the middle button is Accepted or not.
 void setAcceptRightButton(boolean flag)
          Set whether the right button is Accepted or not.
 GraphicalObject setAttachedGraphicalObject(GraphicalObject newGob)
          Set the GraphicalObject this Interpreter is attached to.
 void setEnabled(boolean flag)
          Set whether or not this interpreter is enabled or not (ie can run or not).
 String setName(String strName)
          Set the name of this Interpreter.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InterpreterImpl

public InterpreterImpl()
Empty constructor.
Method Detail

isEnabled

public boolean isEnabled()
Description copied from interface: Interpreter
See if this interpreter is enabled or not (ie can run or not). This is used by the GraphicalObject and by MultiInterpreter before delegating any calls to the Interpreter.

If called by an MultiInterpreter, it just turns that MultiInterpreter off, but not any contained Interpreters.

Specified by:
isEnabled in interface Interpreter

getName

public String getName()
Description copied from interface: Interpreter
Get the name of this Interpreter.
Specified by:
getName in interface Interpreter
Following copied from interface: edu.berkeley.guir.lib.satin.interpreter.Interpreter
Returns:
Some useful not-too-technical real-world name for this Interpreter.

setEnabled

public void setEnabled(boolean flag)
Description copied from interface: Interpreter
Set whether or not this interpreter is enabled or not (ie can run or not).
Specified by:
setEnabled in interface Interpreter

setName

public String setName(String strName)
Description copied from interface: Interpreter
Set the name of this Interpreter.
Specified by:
setName in interface Interpreter
Following copied from interface: edu.berkeley.guir.lib.satin.interpreter.Interpreter
Parameters:
strName - is the new name of this interpreter.
Returns:
a reference to strName.

setAttachedGraphicalObject

public GraphicalObject setAttachedGraphicalObject(GraphicalObject newGob)
Set the GraphicalObject this Interpreter is attached to.
Specified by:
setAttachedGraphicalObject in interface Interpreter
Parameters:
gob - is the GraphicalObject this Interpreter is to be attached to. Okay if null temporarily.

getAttachedGraphicalObject

public GraphicalObject getAttachedGraphicalObject()
Get the GraphicalObject this Interpreter is attached to.
Specified by:
getAttachedGraphicalObject in interface Interpreter
Returns:
a GraphicalObject.

handleNewStroke

public void handleNewStroke(NewStrokeEvent evt)
By default, does nothing.
Specified by:
handleNewStroke in interface StrokeListener
Following copied from interface: edu.berkeley.guir.lib.satin.event.StrokeListener
Parameters:
evt - is the event to handle.

handleUpdateStroke

public void handleUpdateStroke(UpdateStrokeEvent evt)
By default, does nothing.
Specified by:
handleUpdateStroke in interface StrokeListener
Following copied from interface: edu.berkeley.guir.lib.satin.event.StrokeListener
See Also:
StrokeListener.handleNewStroke(NewStrokeEvent).

handleSingleStroke

public void handleSingleStroke(SingleStrokeEvent evt)
By default, does nothing.
Specified by:
handleSingleStroke in interface StrokeListener
Following copied from interface: edu.berkeley.guir.lib.satin.event.StrokeListener
See Also:
StrokeListener.handleNewStroke(NewStrokeEvent).

isConsumedAccepted

public boolean isConsumedAccepted()
Description copied from interface: SatinEventFilter
Check whether consumed events are accepted or not.
Specified by:
isConsumedAccepted in interface SatinEventFilter

isLeftButtonAccepted

public boolean isLeftButtonAccepted()
Description copied from interface: StrokeEventFilter
Check if the left button is Accepted.
Specified by:
isLeftButtonAccepted in interface StrokeEventFilter

isMiddleButtonAccepted

public boolean isMiddleButtonAccepted()
Description copied from interface: StrokeEventFilter
Check if the middle button is Accepted.
Specified by:
isMiddleButtonAccepted in interface StrokeEventFilter

isRightButtonAccepted

public boolean isRightButtonAccepted()
Description copied from interface: StrokeEventFilter
Check if the right button is Accepted.
Specified by:
isRightButtonAccepted in interface StrokeEventFilter

setAcceptConsumed

public void setAcceptConsumed(boolean flag)
Description copied from interface: SatinEventFilter
Set whether consumed events are accepted or not.
Specified by:
setAcceptConsumed in interface SatinEventFilter

setAcceptLeftButton

public void setAcceptLeftButton(boolean flag)
Description copied from interface: StrokeEventFilter
Set whether the left button is Accepted or not.
Specified by:
setAcceptLeftButton in interface StrokeEventFilter

setAcceptMiddleButton

public void setAcceptMiddleButton(boolean flag)
Description copied from interface: StrokeEventFilter
Set whether the middle button is Accepted or not.
Specified by:
setAcceptMiddleButton in interface StrokeEventFilter

setAcceptRightButton

public void setAcceptRightButton(boolean flag)
Description copied from interface: StrokeEventFilter
Set whether the right button is Accepted or not.
Specified by:
setAcceptRightButton in interface StrokeEventFilter

isEventAccepted

public boolean isEventAccepted(StrokeEvent evt)
This method is called for us when an event is handed to us, to ensure that we really want to handle the event.

isEventAccepted

public boolean isEventAccepted(EventObject evt)
This method is called for us when an event is handed to us, to ensure that we really want to handle the event.
Specified by:
isEventAccepted in interface EventFilter

toString

public String toString()
Overrides:
toString in class Object

clone

public abstract Object clone()
Since not overriding clone() can cause many errors with copying-and-pasting, I'm forcing you to do it. So there.
Specified by:
clone in interface Interpreter
Overrides:
clone in class Object

clone

protected InterpreterImpl clone(InterpreterImpl intrp)

Copyright Information