public LocationRangeImpl(Location a, Location b) { if (a.compareTo(b) <= 0) { mStart = a; mEnd = b; } else { mStart = b; mEnd = a; } }
public int compareTo(Entry other) { int thisLoc = mStart.getLocation(); int thatLoc = other.mStart.getLocation(); if (thisLoc < thatLoc) { return -1; } else if (thisLoc > thatLoc) { return 1; } else { return 0; } }
public String toString() { return "start_pc=" + mStart.getLocation() + " => " + "line_number=" + mLineNumber; } }
public boolean equals(Object other) { if (other instanceof Entry) { return mStart.getLocation() == ((Entry)other).mStart.getLocation(); } return false; }
public LocationRangeImpl(Location a, Location b) { if (a.compareTo(b) <= 0) { mStart = a; mEnd = b; } else { mStart = b; mEnd = a; } }
public void writeDataTo(DataOutput dout) throws IOException { int size = mEntries.size(); dout.writeShort(size); for (int i=0; i<size; i++) { Entry entry = mEntries.get(i); int start_pc = entry.mStart.getLocation(); if (start_pc < 0 || start_pc > 65535) { throw new IllegalStateException ("Value for line number table entry start PC out of " + "valid range: " + start_pc); } dout.writeShort(start_pc); dout.writeShort(entry.mLineNumber); } }
public String toString() { int start = getStartLocation().getLocation(); int end = getEndLocation().getLocation() - 1; if (start == end) { return String.valueOf(start); } else { return start + ".." + end; } } }
public int compareTo(Location other) { if (this == other) { return 0; } int loca = getLocation(); int locb = other.getLocation(); if (loca < locb) { return -1; } else if (loca > locb) { return 1; } else { return 0; } }
public LocalVariable getLocalVariable(Location useLocation, int number) { return getLocalVariable(useLocation.getLocation(), number); }
/** * Returns local variable info at the given location, for the given number. * * @return null if unknown */ public LocalVariable getLocalVariable(Location useLocation, int number) { int useLoc = useLocation.getLocation(); if (useLoc < 0) { return null; } else { return getLocalVariable(useLoc, number); } }
public int compareTo(Location other) { if (this == other) { return 0; } int loca = getLocation(); int locb = other.getLocation(); if (loca < locb) { return -1; } else if (loca > locb) { return 1; } else { return 0; } } };
public int compareTo(Location other) { if (this == other) { return 0; } int loca = getLocation(); int locb = other.getLocation(); if (loca < locb) { return -1; } else if (loca > locb) { return 1; } else { return 0; } } };
public int compareTo(Location other) { if (this == other) { return 0; } int loca = getLocation(); int locb = other.getLocation(); if (loca < locb) { return -1; } else if (loca > locb) { return 1; } else { return 0; } } }
/** * Returns the line number in the source code from the given bytecode * address (start_pc). * * @return -1 if no line number is mapped for the start_pc. */ public int getLineNumber(Location start) { LineNumberTableAttr table = mOldLineNumberTable; if (table == null) { table = mLineNumberTable; } if (table == null || start.getLocation() < 0) { return -1; } else { return table.getLineNumber(start); } }
int start_pc = startLocation.getLocation(); int length = endLocation.getLocation() - start_pc - 1;
public LocalVariable getLocalVariable(int useLocation, int number) { // TODO: Build some sort of index to improve performance. for (Entry entry : mEntries) { LocalVariable var = entry.mLocalVar; if (var.getNumber() == number) { for (LocationRange range : var.getLocationRangeSet()) { int start = range.getStartLocation().getLocation(); int end = range.getEndLocation().getLocation(); if (start >= 0 && end >= 0) { if (start <= useLocation && useLocation < end) { return var; } } } } } return null; }
public void writeTo(DataOutput dout) throws IOException { int start_pc = getStartLocation().getLocation(); int end_pc = getEndLocation().getLocation(); int handler_pc = getCatchLocation().getLocation(); int catch_type; ConstantClassInfo catchType = getCatchType(); if (catchType == null) { catch_type = 0; } else { catch_type = catchType.getIndex(); } check("exception start PC", start_pc); check("exception end PC", end_pc); check("exception handler PC", handler_pc); dout.writeShort(start_pc); dout.writeShort(end_pc); dout.writeShort(handler_pc); dout.writeShort(catch_type); }
public void writeDataTo(DataOutput dout) throws IOException { dout.writeShort(mRangeCount); int size = mCleanEntries.size(); for (int i=0; i<size; i++) { Entry entry = mCleanEntries.get(i); LocalVariable localVar = entry.mLocalVar; Set<LocationRange> ranges = localVar.getLocationRangeSet(); if (ranges == null) { continue; } int name_index = entry.mName.getIndex(); int descriptor_index = entry.mDescriptor.getIndex(); int index = localVar.getNumber(); check("local variable table entry name index", name_index); check("local variable table entry descriptor index", descriptor_index); check("local variable table entry index", index); for (LocationRange range : ranges) { Location startLocation = range.getStartLocation(); Location endLocation = range.getEndLocation(); int start_pc = startLocation.getLocation(); int length = endLocation.getLocation() - start_pc - 1; check("local variable table entry start PC", start_pc); dout.writeShort(start_pc); dout.writeShort(length); dout.writeShort(name_index); dout.writeShort(descriptor_index); dout.writeShort(index); } } }