org.apache.bsf.engines.javascript

Class BreakPoint

public class BreakPoint extends 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.

UNKNOWN: Olivier Gruber

Field Summary
protected intm_brkptId
protected DocumentCellm_cell
protected FnOrScriptm_fnOrScript
protected booleanm_lineDefined
protected intm_lineno
protected intm_offset
protected CompilationUnitm_unit
Constructor Summary
BreakPoint(BreakPoint bp)
BreakPoint(DocumentCell cell, int brkptid)
Method Summary
voidattachToFnOrScript(FnOrScript fnOrScript)
attaches this breakpoint to the specified FnOrScript.
intgetId()
intgetLineNo()
intgetOffset()
voidpropagate()
Propagating the breakpoint to its corresponding compilation unit, the side effect of that is to set the breakpoint in the Rhino engine.
voidsetLineNo(int lineno)
voidsetOffset(int offset)
voidsetUnit(CompilationUnit unit)
voidunpropagate()
Unpropagating the breakpoint to its corresponding compilation unit, the side effect of that is to unset the breakpoint in the Rhino engine.

Field Detail

m_brkptId

protected int m_brkptId

m_cell

protected DocumentCell m_cell

m_fnOrScript

protected FnOrScript m_fnOrScript

m_lineDefined

protected boolean m_lineDefined

m_lineno

protected int m_lineno

m_offset

protected int m_offset

m_unit

protected CompilationUnit m_unit

Constructor Detail

BreakPoint

public BreakPoint(BreakPoint bp)

BreakPoint

public BreakPoint(DocumentCell cell, int brkptid)

Method Detail

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()

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...

getOffset

public int getOffset()

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...

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.

setLineNo

public void setLineNo(int lineno)

setOffset

public void setOffset(int offset)

setUnit

public void setUnit(CompilationUnit unit)

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.