FileDocCategorySizeDatePackage
LineNumber.javaAPI DocJava SE 6 API5409Tue Jun 10 00:22:18 BST 2008com.sun.org.apache.bcel.internal.classfile

LineNumber

public final class LineNumber extends Object implements Serializable, Node, Cloneable
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,v 1.1.2.1 2005/07/31 23:46:21 jeffsuttor Exp $
author
M. Dahm
see
LineNumberTable

Fields Summary
private int
start_pc
private int
line_number
Constructors Summary
public LineNumber(LineNumber c)
Initialize from another object.

    this(c.getStartPC(), c.getLineNumber());
  
LineNumber(DataInputStream file)
Construct object from file stream.

param
file Input stream
throws
IOException

    this(file.readUnsignedShort(), file.readUnsignedShort());
  
public LineNumber(int start_pc, int line_number)

param
start_pc Program Counter (PC) corresponds to
param
line_number line number in source file

    this.start_pc    = start_pc;
    this.line_number = line_number;
  
Methods Summary
public voidaccept(com.sun.org.apache.bcel.internal.classfile.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.

param
v Visitor object

    v.visitLineNumber(this);
  
public com.sun.org.apache.bcel.internal.classfile.LineNumbercopy()

return
deep copy of this object

    try {
      return (LineNumber)clone();
    } catch(CloneNotSupportedException e) {}

    return null;
  
public final voiddump(java.io.DataOutputStream file)
Dump line number/pc pair to file stream in binary format.

param
file Output file stream
throws
IOException

    file.writeShort(start_pc);
    file.writeShort(line_number);

  
public final intgetLineNumber()

return
Corresponding source line

 return line_number; 
public final intgetStartPC()

return
PC in code

 return start_pc; 
public final voidsetLineNumber(int line_number)

param
line_number.

    this.line_number = line_number;
  
public final voidsetStartPC(int start_pc)

param
start_pc.

    this.start_pc = start_pc;
  
public final java.lang.StringtoString()

return
String representation

    return "LineNumber(" + start_pc + ", " + line_number + ")";