org.apache.bcel.classfile

Class LineNumber

Implemented Interfaces:
Cloneable, Node, Serializable

public final class LineNumber
extends java.lang.Object
implements Cloneable, Node, Serializable

This class represents a (PC offset, line number) pair, i.e., a line number in the source that corresponds to a relative address in the byte code. This is used for debugging purposes.
Version:
$Id: LineNumber.java 386056 2006-03-15 11:31:56Z tcurdt $
Author:
M. Dahm
See Also:
LineNumberTable

Field Summary

private int
line_number
private int
start_pc

Constructor Summary

LineNumber(DataInputStream file)
Construct object from file stream.
LineNumber(int start_pc, int line_number)
LineNumber(LineNumber c)
Initialize from another object.

Method Summary

void
accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class.
LineNumber
copy()
void
dump(DataOutputStream file)
Dump line number/pc pair to file stream in binary format.
int
getLineNumber()
int
getStartPC()
void
setLineNumber(int line_number)
void
setStartPC(int start_pc)
String
toString()

Field Details

line_number

private int line_number

start_pc

private int start_pc

Constructor Details

LineNumber

(package private)  LineNumber(DataInputStream file)
            throws IOException
Construct object from file stream.
Parameters:
file - Input stream

LineNumber

public LineNumber(int start_pc,
                  int line_number)
Parameters:
start_pc - Program Counter (PC) corresponds to
line_number - line number in source file

LineNumber

public LineNumber(LineNumber c)
Initialize from another object.

Method Details

accept

public void accept(Visitor v)
Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
Specified by:
accept in interface Node
Parameters:
v - Visitor object

copy

public LineNumber copy()
Returns:
deep copy of this object

dump

public final void dump(DataOutputStream file)
            throws IOException
Dump line number/pc pair to file stream in binary format.
Parameters:
file - Output file stream

getLineNumber

public final int getLineNumber()
Returns:
Corresponding source line

getStartPC

public final int getStartPC()
Returns:
PC in code

setLineNumber

public final void setLineNumber(int line_number)
Parameters:
line_number - the source line number

setStartPC

public final void setStartPC(int start_pc)
Parameters:
start_pc - the pc for this line number

toString

public final String toString()
Returns:
String representation