1 55 56 package org.apache.bsf.engines.javascript; 57 58 import org.apache.bsf.*; 59 60 95 public class BreakPoint { 96 97 protected int m_brkptId; 98 protected int m_lineno; 99 protected int m_offset; 100 protected boolean m_lineDefined; 101 102 protected DocumentCell m_cell; 103 protected FnOrScript m_fnOrScript; 104 105 protected CompilationUnit m_unit; 106 107 public BreakPoint(BreakPoint bp) { 108 m_fnOrScript = bp.m_fnOrScript; 109 m_cell = bp.m_cell; 110 m_brkptId = bp.m_brkptId; 111 m_lineno = bp.m_lineno; 112 m_offset = bp.m_offset; 113 m_lineDefined = bp.m_lineDefined; 114 m_unit = bp.m_unit; 115 } 116 public BreakPoint(DocumentCell cell, int brkptid) { 117 super(); 118 m_fnOrScript = null; 119 m_cell = cell; 120 m_brkptId = brkptid; 121 m_lineno = -1; 122 m_lineDefined = true; 123 m_unit=null; 124 } 125 public void setUnit(CompilationUnit unit) { 126 m_unit = unit; 127 } 128 129 134 public void propagate() { 135 if (m_unit != null) { 136 m_unit.propagate(m_lineno); 137 } 138 } 139 144 public void unpropagate() { 145 if (m_unit != null) { 146 m_unit.unpropagate(m_lineno); 147 } 148 } 149 150 153 public void attachToFnOrScript(FnOrScript fnOrScript) { 154 m_fnOrScript = fnOrScript; 155 } 156 159 public int getId() { 160 return m_brkptId; 161 } 162 169 public int getLineNo() throws BSFException { 170 if (!m_lineDefined) 171 throw new BSFException( 172 BSFException.REASON_INVALID_ARGUMENT, 173 "Breakpoint is offset defined, can't provide its line number."); 174 return m_lineno; 175 } 176 183 public int getOffset() throws BSFException { 184 if (m_lineDefined) 185 throw new BSFException( 186 BSFException.REASON_INVALID_ARGUMENT, 187 "Breakpoint is line defined, can't provide its offset."); 188 return m_offset; 189 } 190 191 public void setLineNo(int lineno) { 192 m_lineno = lineno; 193 } 194 public void setOffset(int offset) { 195 m_offset = offset; 196 } 197 } 198 | Popular Tags |