FileDocCategorySizeDatePackage
LineNumberGen.javaAPI DocJava SE 5 API4861Fri Aug 26 14:55:22 BST 2005com.sun.org.apache.bcel.internal.generic

LineNumberGen

public class LineNumberGen extends Object implements InstructionTargeter, Cloneable
This class represents a line number within a method, i.e., give an instruction a line number corresponding to the source code line.
version
$Id: LineNumberGen.java,v 1.1.1.1 2001/10/29 20:00:23 jvanzyl Exp $
author
M. Dahm
see
LineNumber
see
MethodGen

Fields Summary
private InstructionHandle
ih
private int
src_line
Constructors Summary
public LineNumberGen(InstructionHandle ih, int src_line)
Create a line number.

param
ih instruction handle to reference
return
new line number object

    setInstruction(ih);
    setSourceLine(src_line);
  
Methods Summary
public java.lang.Objectclone()

    try {
      return super.clone();
    } catch(CloneNotSupportedException e) {
      System.err.println(e);
      return null;
    }
  
public booleancontainsTarget(com.sun.org.apache.bcel.internal.generic.InstructionHandle ih)

return
true, if ih is target of this line number

    return this.ih == ih;
  
public com.sun.org.apache.bcel.internal.generic.InstructionHandlegetInstruction()

 return ih; 
public com.sun.org.apache.bcel.internal.classfile.LineNumbergetLineNumber()
Get LineNumber attribute . This relies on that the instruction list has already been dumped to byte code or or that the `setPositions' methods has been called for the instruction list.

    return new LineNumber(ih.getPosition(), src_line);
  
public intgetSourceLine()

 return src_line; 
public voidsetInstruction(com.sun.org.apache.bcel.internal.generic.InstructionHandle ih)

    BranchInstruction.notifyTarget(this.ih, ih, this);

    this.ih = ih;
  
public voidsetSourceLine(int src_line)

 this.src_line = src_line; 
public voidupdateTarget(com.sun.org.apache.bcel.internal.generic.InstructionHandle old_ih, com.sun.org.apache.bcel.internal.generic.InstructionHandle new_ih)

param
old_ih old target
param
new_ih new target

    if(old_ih != ih)
      throw new ClassGenException("Not targeting " + old_ih + ", but " + ih + "}");
    else
      setInstruction(new_ih);