1 17 package org.apache.bcel.classfile; 18 19 import java.io.DataInputStream ; 20 import java.io.DataOutputStream ; 21 import java.io.IOException ; 22 import java.io.Serializable ; 23 24 33 public final class LineNumber implements Cloneable , Node, Serializable { 34 35 private int start_pc; private int line_number; 38 39 42 public LineNumber(LineNumber c) { 43 this(c.getStartPC(), c.getLineNumber()); 44 } 45 46 47 52 LineNumber(DataInputStream file) throws IOException { 53 this(file.readUnsignedShort(), file.readUnsignedShort()); 54 } 55 56 57 61 public LineNumber(int start_pc, int line_number) { 62 this.start_pc = start_pc; 63 this.line_number = line_number; 64 } 65 66 67 74 public void accept( Visitor v ) { 75 v.visitLineNumber(this); 76 } 77 78 79 85 public final void dump( DataOutputStream file ) throws IOException { 86 file.writeShort(start_pc); 87 file.writeShort(line_number); 88 } 89 90 91 94 public final int getLineNumber() { 95 return line_number; 96 } 97 98 99 102 public final int getStartPC() { 103 return start_pc; 104 } 105 106 107 110 public final void setLineNumber( int line_number ) { 111 this.line_number = line_number; 112 } 113 114 115 118 public final void setStartPC( int start_pc ) { 119 this.start_pc = start_pc; 120 } 121 122 123 126 public final String toString() { 127 return "LineNumber(" + start_pc + ", " + line_number + ")"; 128 } 129 130 131 134 public LineNumber copy() { 135 try { 136 return (LineNumber) clone(); 137 } catch (CloneNotSupportedException e) { 138 } 139 return null; 140 } 141 } 142 | Popular Tags |