org.apache.bsf.engines.javascript
Class BreakPoint

java.lang.Object
  |
  +--org.apache.bsf.engines.javascript.BreakPoint

public class BreakPoint
extends java.lang.Object

Materializes a breakpoint. A breakpoint can be defined at a line number or an offset character in its document. For JavaScript, we only support lineno for the underlying Rhino engine does support only the line numbers. Note: this is unfortunate for this prevents setting a breakpoint on different statements on the same line... A breakpoint is remembered at either the document level (DocumentCell) or the function/script level (FnOrScript). It is remembered at the document level when a FnOrScript is not yet known for the breakpoint line number. When a matching FnOrScrip will become known (compiled in Rhino), the breakpoint will be remembered at the FnOrScript level. Additionally, a breakpoint can be correlated or not to a compilation unit. When not correlated (m_unit==null), it means a compilation unit for the breakpoint line has not been seen yet. It may be because the breakpoint is on an invalid line but it may be also that the breakpoint is in a script or function that has not been compiled yet. Indeed, there is a delay between knowing about a FnOrScript and knowing about all its compilation unit. When a FnOrScript is about to be compiled in Rhino, we create the FnOrScript, with no known compilation unit. As a side effect of compiling, the Rhino engine calls us back with compilation units such as independent functions or scripts. This is when those units, represented by our class CompilationUnit are added to the corresponding FnOrScript.


Field Summary
protected  int m_brkptId
           
protected  DocumentCell m_cell
           
protected  FnOrScript m_fnOrScript
           
protected  boolean m_lineDefined
           
protected  int m_lineno
           
protected  int m_offset
           
protected  CompilationUnit m_unit
           
 
Constructor Summary
BreakPoint(BreakPoint bp)
           
BreakPoint(DocumentCell cell, int brkptid)
           
 
Method Summary
 void attachToFnOrScript(FnOrScript fnOrScript)
          attaches this breakpoint to the specified FnOrScript.
 int getId()
           
 int getLineNo()
           
 int getOffset()
           
 void propagate()
          Propagating the breakpoint to its corresponding compilation unit, the side effect of that is to set the breakpoint in the Rhino engine.
 void setLineNo(int lineno)
           
 void setOffset(int offset)
           
 void setUnit(CompilationUnit unit)
           
 void unpropagate()
          Unpropagating the breakpoint to its corresponding compilation unit, the side effect of that is to unset the breakpoint in the Rhino engine.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_brkptId

protected int m_brkptId

m_lineno

protected int m_lineno

m_offset

protected int m_offset

m_lineDefined

protected boolean m_lineDefined

m_cell

protected DocumentCell m_cell

m_fnOrScript

protected FnOrScript m_fnOrScript

m_unit

protected CompilationUnit m_unit
Constructor Detail

BreakPoint

public BreakPoint(BreakPoint bp)

BreakPoint

public BreakPoint(DocumentCell cell,
                  int brkptid)
Method Detail

setUnit

public void setUnit(CompilationUnit unit)

propagate

public void propagate()
Propagating the breakpoint to its corresponding compilation unit, the side effect of that is to set the breakpoint in the Rhino engine.


unpropagate

public void unpropagate()
Unpropagating the breakpoint to its corresponding compilation unit, the side effect of that is to unset the breakpoint in the Rhino engine.


attachToFnOrScript

public void attachToFnOrScript(FnOrScript fnOrScript)
attaches this breakpoint to the specified FnOrScript.


getId

public int getId()
Returns:
the identifier of the breakpoint.

getLineNo

public int getLineNo()
              throws BSFException
Returns:
the line number of that breakpoint. This method will succeed only if the breakpoint as been defined at a line number. There is no automated translation between line number and offsets...
BSFException

getOffset

public int getOffset()
              throws BSFException
Returns:
the character offset of that breakpoint. This method will succeed only if the breakpoint as been defined at an offset. There is no automated translation between line number and offsets...
BSFException

setLineNo

public void setLineNo(int lineno)

setOffset

public void setOffset(int offset)