adalogo.visitor

Class VisitorMaster

Implemented Interfaces:
EventListener, Runnable, FileHandler.FileHandlerListener

public class VisitorMaster
extends java.lang.Object
implements Runnable, FileHandler.FileHandlerListener

this will manage the visitors in threads TODO make visitors speak only to master all actions to outside should be handled with invokeLater

Nested Class Summary

Constructor Summary

VisitorMaster(Engine engine)
create a visitor master

Method Summary

void
addVisitorListener(VisitorMaster.VisitorListener listener)
void
documentChanged(FileHandler.FileHandlerEvent e)
void
documentLoadFailed(FileHandler.FileHandlerEvent e)
void
documentLoaded(FileHandler.FileHandlerEvent e)
void
documentSaveFailed(FileHandler.FileHandlerEvent e)
void
documentSaved(FileHandler.FileHandlerEvent e)
BreakPointTable
getBreakPointTable()
editor will call this to insert break point handler in line number panel.
Action
getMultiStepAction()
Action
getSingleStepAction()
Action
getStartAction()
Action
getStartDebugAction()
Action
getStopAction()
boolean
isBreak(int line)
visitors should check this and suspend operation when this returns true.
boolean
isDebugRun()
visitors should call this to check if debug run.
boolean
isStopRequested()
the running visitor should check this frequently and stop as soon as possible if this is true.
void
run()
thread to process all the parsing and interpreting.
void
startVisitor(boolean debug)
this will start a visitor.
void
stepVisitor(boolean single)
make visitor continue if it is waiting.
void
stopVisitor()
make interpreter stop as soon as possible.
void
visitorRunning()
the waiting visitor is now running again.
void
visitorStarted()
a visitor just started.
void
visitorStopped()
the running visitor just stopped.
void
visitorWaiting(int line)
visitor will wait until someone calls notify.

Constructor Details

VisitorMaster

public VisitorMaster(Engine engine)
create a visitor master

Parameters:
engine -

Method Details

addVisitorListener

public void addVisitorListener(VisitorMaster.VisitorListener listener)


documentChanged

public void documentChanged(FileHandler.FileHandlerEvent e)
Specified by:
documentChanged in interface FileHandler.FileHandlerListener


documentLoadFailed

public void documentLoadFailed(FileHandler.FileHandlerEvent e)
Specified by:
documentLoadFailed in interface FileHandler.FileHandlerListener


documentLoaded

public void documentLoaded(FileHandler.FileHandlerEvent e)
Specified by:
documentLoaded in interface FileHandler.FileHandlerListener


documentSaveFailed

public void documentSaveFailed(FileHandler.FileHandlerEvent e)
Specified by:
documentSaveFailed in interface FileHandler.FileHandlerListener


documentSaved

public void documentSaved(FileHandler.FileHandlerEvent e)
Specified by:
documentSaved in interface FileHandler.FileHandlerListener


getBreakPointTable

public BreakPointTable getBreakPointTable()
editor will call this to insert break point handler in line number panel.


getMultiStepAction

public Action getMultiStepAction()


getSingleStepAction

public Action getSingleStepAction()


getStartAction

public Action getStartAction()


getStartDebugAction

public Action getStartDebugAction()


getStopAction

public Action getStopAction()


isBreak

public boolean isBreak(int line)
visitors should check this and suspend operation when this returns true.

Returns:
true if run single step or if run debug and break point exists


isDebugRun

public boolean isDebugRun()
visitors should call this to check if debug run.


isStopRequested

public boolean isStopRequested()
the running visitor should check this frequently and stop as soon as possible if this is true.

Returns:
true if user requested interpreter to stop.


run

public void run()
thread to process all the parsing and interpreting. this thread will parse the code (javacc) and then start a visitor which will visit the syntax tree (AST*.java).
HERE IS PARSER AND VISITOR BEGIN

See Also:
startVisitor(boolean)


startVisitor

public void startVisitor(boolean debug)
this will start a visitor. called by user interaction.


stepVisitor

public void stepVisitor(boolean single)
make visitor continue if it is waiting. called by user interaction.


stopVisitor

public void stopVisitor()
make interpreter stop as soon as possible. called by user interaction.


visitorRunning

public void visitorRunning()
the waiting visitor is now running again. called by visitor.


visitorStarted

public void visitorStarted()
a visitor just started. called by visitor.


visitorStopped

public void visitorStopped()
the running visitor just stopped. called by visitor.


visitorWaiting

public void visitorWaiting(int line)
visitor will wait until someone calls notify. called by visitor.