org.apache.bsf.engines.javascript
Class DocumentCell

java.lang.Object
  extended by org.apache.bsf.engines.javascript.DocumentCell

public class DocumentCell
extends java.lang.Object

A document cell materializes a known document. A document is a container for scripts or functions in JavaScript. The document is known as soon as a function or script is compiled in the engine. Compilation occurs as a side-effect of evaluating or executing a function or a script. Upon the first loading of a function or script of a document, the document becomes known and the debug manager is notified of the load. The debug manager will in turn notify the engine of all the known breakpoints for that document. When a breakpoint is propagated from the debug manager to an engine, the document will be added a breakpoint. The document will memorize the breakpoints if their corresponding function or script is not known at that time. If it is known, it is the FnOrScript that will memorize the breakpoint. See FnOrScript to see how a breakpoint is actually forwarded to the underlying Rhino engine.


Constructor Summary
DocumentCell(RhinoEngineDebugger rhinoDebugger, java.lang.String name)
           
 
Method Summary
 void addBreakpointAtLine(int brkptId, int lineno)
          Add a breakpoint.
 void addBreakpointAtOffset(int brkptId, int offset)
          Same as above, except the breakpoint is specified at an character offset rather than a line number.
 BreakPoint findBreakpointAtLine(int lineno)
           
 BreakPoint findBreakpointAtOffset(int offset)
           
 FnOrScript findFnOrScript(int startLine, int column)
           
 FnOrScript findFnOrScriptContaining(int line)
           
 java.util.Enumeration fnOrScripts()
           
 boolean getEntryExit()
           
 FnOrScript getLastFnOrScript()
           
 java.lang.String getName()
           
 FnOrScript registerFnOrScriptLines(java.io.Reader reader, int startLine, int column)
           
 FnOrScript registerFnOrScriptLines(java.lang.String source, int startLine, int column)
           
 FnOrScript registerFnOrScriptRange(java.io.Reader reader, int offset)
           
 FnOrScript registerFnOrScriptRange(java.lang.String source, int offset)
           
 BreakPoint removeBreakpoint(int brkptId)
          Removing a breakpoint.
 void setEntryExit(boolean on_value)
           
 void setLastFnOrScript(FnOrScript fnos)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentCell

public DocumentCell(RhinoEngineDebugger rhinoDebugger,
                    java.lang.String name)
Method Detail

getName

public java.lang.String getName()

addBreakpointAtLine

public void addBreakpointAtLine(int brkptId,
                                int lineno)
Add a breakpoint. Two cases exist. If a function or a script (FnOrScript) is known for the given line number, the breakpoint will be remembered by that FnOrScript. Otherwise, the breakpoint is memorized at the document level until a function or script is known, that is, compiled in our engine.


addBreakpointAtOffset

public void addBreakpointAtOffset(int brkptId,
                                  int offset)
Same as above, except the breakpoint is specified at an character offset rather than a line number.


findBreakpointAtLine

public BreakPoint findBreakpointAtLine(int lineno)
                                throws BSFException
Throws:
BSFException

findBreakpointAtOffset

public BreakPoint findBreakpointAtOffset(int offset)
                                  throws BSFException
Throws:
BSFException

findFnOrScript

public FnOrScript findFnOrScript(int startLine,
                                 int column)

findFnOrScriptContaining

public FnOrScript findFnOrScriptContaining(int line)

fnOrScripts

public java.util.Enumeration fnOrScripts()

registerFnOrScriptLines

public FnOrScript registerFnOrScriptLines(java.io.Reader reader,
                                          int startLine,
                                          int column)
                                   throws BSFException
Throws:
BSFException

registerFnOrScriptLines

public FnOrScript registerFnOrScriptLines(java.lang.String source,
                                          int startLine,
                                          int column)
                                   throws BSFException
Throws:
BSFException

registerFnOrScriptRange

public FnOrScript registerFnOrScriptRange(java.io.Reader reader,
                                          int offset)
                                   throws BSFException
Throws:
BSFException

registerFnOrScriptRange

public FnOrScript registerFnOrScriptRange(java.lang.String source,
                                          int offset)
                                   throws BSFException
Throws:
BSFException

removeBreakpoint

public BreakPoint removeBreakpoint(int brkptId)
Removing a breakpoint. Two cases, a breakpoint is only remembered at the document level, it has not been propagated to a function or script (FnOrScript). Then, just drop it. Second case, the breakpoint has been propagated, then scan the FnOrScript objects and ask them to drop the breakpoint. Note: only one will have it, see addBreakpoint...


setEntryExit

public void setEntryExit(boolean on_value)

getEntryExit

public boolean getEntryExit()

setLastFnOrScript

public void setLastFnOrScript(FnOrScript fnos)

getLastFnOrScript

public FnOrScript getLastFnOrScript()