edu.rice.cs.drjava.model.repl
Class InteractionsModelTest.TestInteractionsModel

java.lang.Object
  extended by edu.rice.cs.drjava.model.repl.InteractionsModel
      extended by edu.rice.cs.drjava.model.repl.InteractionsModelTest.TestInteractionsModel
All Implemented Interfaces:
InteractionsModelCallback
Enclosing class:
InteractionsModelTest

public static class InteractionsModelTest.TestInteractionsModel
extends InteractionsModel

A generic InteractionsModel for testing purposes. (Used here and in InteractionsPaneTest.)


Field Summary
 
Fields inherited from class edu.rice.cs.drjava.model.repl.InteractionsModel
_cDoc, _document, _inputListener, _lastError, _notifier, _pane, _secondToLastError, _waitingForFirstInterpreter, _workingDirectory, _writerLock, BANNER_PREFIX
 
Constructor Summary
InteractionsModelTest.TestInteractionsModel(InteractionsDJDocument adapter)
          Constructs a new InteractionsModel.
 
Method Summary
protected  void _interpret(String toEval)
          Sets toEval field and simulates successful interpretation.
protected  void _interpreterResetFailed(Throwable t)
          Any extra action to perform (beyond notifying listeners) when the interpreter fails to reset.
 void _logInteractionStart()
           
protected  void _notifyInteractionEnded()
          Notifies listeners that an interaction has ended.
protected  void _notifyInteractionIncomplete()
          Notifies the view that the current interaction is incomplete.
 void _notifyInteractionStarted()
          Notifies listeners that an interaction has started.
protected  void _notifyInterpreterExited(int status)
          Notifies listeners that the interpreter has exited unexpectedly.
 void _notifyInterpreterReady(File wd)
          Notifies listeners that the interpreter is ready.
protected  void _notifyInterpreterResetFailed(Throwable t)
          Notifies listeners that the interpreter reset failed.
protected  void _notifyInterpreterResetting()
          Notifies listeners that the interpreter is resetting.
protected  void _notifySlaveJVMUsed()
          Notifies listeners that the slave JVM has been used.
protected  void _notifySyntaxErrorOccurred(int offset, int length)
          Handles a syntax error being returned from an interaction
protected  void _resetInterpreter(File wd)
          Resets the Java interpreter.
 void _waitInteractionDone()
           
 void addBuildDirectoryClassPath(File path)
          These add the given path to the build directory classpaths used in the interpreter.
 void addExternalFilesClassPath(File path)
          These add the given path to the external files classpaths used in the interpreter.
 void addExtraClassPath(File path)
          These add the given path to the extra classpaths used in the interpreter.
 void addProjectClassPath(File path)
          These add the given path to the classpaths used in the interpreter.
 void addProjectFilesClassPath(File path)
          These add the given path to the project files classpaths used in the interpreter.
 ConsoleDocument getConsoleDocument()
          Gets the console tab document for this interactions model
 String getVariableToString(String var)
          Gets the string representation of the value of a variable in the current interpreter.
 String getVariableType(String var)
          Gets the class name of a variable in the current interpreter.
 
Methods inherited from class edu.rice.cs.drjava.model.repl.InteractionsModel
_addNewline, _createNewDebugPort, _deleteSemiColon, _getHistoryText, _interactionIsOver, _removeSeparators, _testClassCall, _writerDelay, addListener, append, changeInputListener, getBanner, getBanner, getConsoleInput, getDebugPort, getDocument, getLastError, getSecondToLastError, getStartUpBanner, getWorkingDirectory, interactionContinues, interpret, interpretCurrentInteraction, interpreterReady, interpreterResetFailed, interpreterResetting, loadHistory, loadHistoryAsScript, removeAllInteractionListeners, removeLastFromHistory, removeListener, replCalledSystemExit, replReturnedResult, replReturnedSyntaxError, replReturnedVoid, replSystemErrPrint, replSystemOutPrint, replThrewException, resetInterpreter, resetLastErrors, scrollToCaret, setDebugPort, setInputListener, setUpPane, setWaitingForFirstInterpreter, slaveJVMUsed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InteractionsModelTest.TestInteractionsModel

public InteractionsModelTest.TestInteractionsModel(InteractionsDJDocument adapter)
Constructs a new InteractionsModel.

Method Detail

_logInteractionStart

public void _logInteractionStart()

_waitInteractionDone

public void _waitInteractionDone()
                          throws InterruptedException
Throws:
InterruptedException

_interpret

protected void _interpret(String toEval)
Sets toEval field and simulates successful interpretation.

Specified by:
_interpret in class InteractionsModel
Parameters:
toEval - command to be evaluated

_notifyInteractionEnded

protected void _notifyInteractionEnded()
Description copied from class: InteractionsModel
Notifies listeners that an interaction has ended. (Subclasses must maintain listeners.)

Specified by:
_notifyInteractionEnded in class InteractionsModel

getVariableToString

public String getVariableToString(String var)
Description copied from class: InteractionsModel
Gets the string representation of the value of a variable in the current interpreter.

Specified by:
getVariableToString in class InteractionsModel
Parameters:
var - the name of the variable
Returns:
A string representation of the value, or null if the variable is not defined.

getVariableType

public String getVariableType(String var)
Description copied from class: InteractionsModel
Gets the class name of a variable in the current interpreter.

Specified by:
getVariableType in class InteractionsModel
Parameters:
var - the name of the variable

addProjectClassPath

public void addProjectClassPath(File path)
Description copied from class: InteractionsModel
These add the given path to the classpaths used in the interpreter.

Specified by:
addProjectClassPath in class InteractionsModel
Parameters:
path - the path to add

addBuildDirectoryClassPath

public void addBuildDirectoryClassPath(File path)
Description copied from class: InteractionsModel
These add the given path to the build directory classpaths used in the interpreter.

Specified by:
addBuildDirectoryClassPath in class InteractionsModel
Parameters:
path - the path to add

addProjectFilesClassPath

public void addProjectFilesClassPath(File path)
Description copied from class: InteractionsModel
These add the given path to the project files classpaths used in the interpreter.

Specified by:
addProjectFilesClassPath in class InteractionsModel
Parameters:
path - the path to add

addExternalFilesClassPath

public void addExternalFilesClassPath(File path)
Description copied from class: InteractionsModel
These add the given path to the external files classpaths used in the interpreter.

Specified by:
addExternalFilesClassPath in class InteractionsModel
Parameters:
path - the path to add

addExtraClassPath

public void addExtraClassPath(File path)
Description copied from class: InteractionsModel
These add the given path to the extra classpaths used in the interpreter.

Specified by:
addExtraClassPath in class InteractionsModel
Parameters:
path - the path to add

_resetInterpreter

protected void _resetInterpreter(File wd)
Description copied from class: InteractionsModel
Resets the Java interpreter. This should only be called from resetInterpreter, never directly.

Specified by:
_resetInterpreter in class InteractionsModel

_notifyInteractionStarted

public void _notifyInteractionStarted()
Description copied from class: InteractionsModel
Notifies listeners that an interaction has started. (Subclasses must maintain listeners.)

Specified by:
_notifyInteractionStarted in class InteractionsModel

_notifySyntaxErrorOccurred

protected void _notifySyntaxErrorOccurred(int offset,
                                          int length)
Description copied from class: InteractionsModel
Handles a syntax error being returned from an interaction

Specified by:
_notifySyntaxErrorOccurred in class InteractionsModel
Parameters:
offset - the first character of the error in the InteractionsDocument
length - the length of the error.

_notifyInterpreterExited

protected void _notifyInterpreterExited(int status)
Description copied from class: InteractionsModel
Notifies listeners that the interpreter has exited unexpectedly. (Subclasses must maintain listeners.)

Specified by:
_notifyInterpreterExited in class InteractionsModel
Parameters:
status - Status code of the dead process

_notifyInterpreterResetting

protected void _notifyInterpreterResetting()
Description copied from class: InteractionsModel
Notifies listeners that the interpreter is resetting. (Subclasses must maintain listeners.)

Specified by:
_notifyInterpreterResetting in class InteractionsModel

_notifyInterpreterResetFailed

protected void _notifyInterpreterResetFailed(Throwable t)
Description copied from class: InteractionsModel
Notifies listeners that the interpreter reset failed. (Subclasses must maintain listeners.)

Specified by:
_notifyInterpreterResetFailed in class InteractionsModel
Parameters:
t - Throwable explaining why the reset failed.

_notifyInterpreterReady

public void _notifyInterpreterReady(File wd)
Description copied from class: InteractionsModel
Notifies listeners that the interpreter is ready. (Subclasses must maintain listeners.)

Specified by:
_notifyInterpreterReady in class InteractionsModel

_interpreterResetFailed

protected void _interpreterResetFailed(Throwable t)
Description copied from class: InteractionsModel
Any extra action to perform (beyond notifying listeners) when the interpreter fails to reset.

Specified by:
_interpreterResetFailed in class InteractionsModel
Parameters:
t - The Throwable thrown by System.exit

_notifyInteractionIncomplete

protected void _notifyInteractionIncomplete()
Description copied from class: InteractionsModel
Notifies the view that the current interaction is incomplete.

Specified by:
_notifyInteractionIncomplete in class InteractionsModel

_notifySlaveJVMUsed

protected void _notifySlaveJVMUsed()
Description copied from class: InteractionsModel
Notifies listeners that the slave JVM has been used. (Subclasses must maintain listeners.)

Specified by:
_notifySlaveJVMUsed in class InteractionsModel

getConsoleDocument

public ConsoleDocument getConsoleDocument()
Description copied from class: InteractionsModel
Gets the console tab document for this interactions model

Specified by:
getConsoleDocument in class InteractionsModel