frysk.debuginfo
Class PieceLocation

java.lang.Object
  extended by frysk.value.Location
      extended by frysk.debuginfo.PieceLocation

public class PieceLocation
extends Location


Field Summary
private  List pieces
           
 
Constructor Summary
PieceLocation(List pieces)
           
 
Method Summary
static Location createSimpleLoc(long address, long size, ByteBuffer buf)
          Creates a simple single piece memory location.
 long getAddress()
          Returns the address only if value is in a _contiguous memory_ location.
protected  byte getByte(long offset)
          Return the byte at OFFSET.
 List getPieces()
           
private  long indexOf(long offset)
          Function to map overall byte index to piece byte index.
 long length()
          Returns the number of bytes in location.
private  Piece pieceOf(long offset)
          Function that returns the piece of given offset.
protected  void putByte(long offset, byte value)
          Stores the byte VALUE at OFFSET.
protected  Location slice(long offset, long length)
          Return a slice of this Location starting at byte OFFSET, and going for LENGTH bytes.
private  long sliceLength(List slice)
          Helper function for slice - returns the number of bytes in slice list.
 void toPrint(PrintWriter writer)
          Print this Location.
 
Methods inherited from class frysk.value.Location
get, put, toByteArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

pieces

private final List pieces
Constructor Detail

PieceLocation

public PieceLocation(List pieces)
Method Detail

getPieces

public List getPieces()

toPrint

public void toPrint(PrintWriter writer)
Description copied from class: Location
Print this Location.

Specified by:
toPrint in class Location

getAddress

public long getAddress()
Returns the address only if value is in a _contiguous memory_ location.

Specified by:
getAddress in class Location

createSimpleLoc

public static Location createSimpleLoc(long address,
                                       long size,
                                       ByteBuffer buf)
Creates a simple single piece memory location.


indexOf

private long indexOf(long offset)
Function to map overall byte index to piece byte index.

Parameters:
offset - - overall byte offset of value
Returns:
- piece index

pieceOf

private Piece pieceOf(long offset)
Function that returns the piece of given offset.

Parameters:
offset - - overall byte offset of value
Returns:
- piece that contains the byte at OFFSET

getByte

protected byte getByte(long offset)
Return the byte at OFFSET.

Specified by:
getByte in class Location

putByte

protected void putByte(long offset,
                       byte value)
Stores the byte VALUE at OFFSET.

Specified by:
putByte in class Location

length

public long length()
Returns the number of bytes in location.

Specified by:
length in class Location

slice

protected Location slice(long offset,
                         long length)
Return a slice of this Location starting at byte OFFSET, and going for LENGTH bytes. The slice can contain multiple pieces.

Specified by:
slice in class Location

sliceLength

private long sliceLength(List slice)
Helper function for slice - returns the number of bytes in slice list. Similar to length but takes List instead of PieceLocation.