org.gudy.azureus2.core3.disk
Interface DiskManagerPiece

All Known Implementing Classes:
DiskManagerPieceImpl, LWSDiskManager.sePiece

public interface DiskManagerPiece

Represents a DiskManager Piece

Author:
parg, MjrTom 2005/Oct/08: priority handling 2006/Jan/2: refactoring, mostly to base Piece interface

Method Summary
 boolean calcDone()
           
 boolean calcNeeded()
           
 void clearNeeded()
           
 int getBlockSize(int block_index)
           
 int getLength()
           
 DiskManager getManager()
           
 int getNbBlocks()
           
 int getNbWritten()
           
 int getPieceNumber()
           
 short getReadCount()
           
 String getString()
           
 boolean[] getWritten()
           
 boolean isChecking()
           
 boolean isDone()
           
 boolean isDownloadable()
          This must not be used to qualify pieces in End Game Mode.
 boolean isInteresting()
           
 boolean isNeeded()
           
 boolean isNeedsCheck()
           
 boolean isSkipped()
          returns true if all the files that the piece spans are skipped
 boolean isWritten()
           
 boolean isWritten(int blockNumber)
           
 void reDownloadBlock(int blockNumber)
           
 void reset()
           
 void setChecking()
           
 void setDone(boolean b)
           
 void setDownloadable()
           
 void setNeeded()
           
 void setNeeded(boolean b)
           
 void setReadCount(short c)
           
 void setWritten(int blockNumber)
           
 boolean spansFiles()
           
 

Method Detail

getManager

DiskManager getManager()

getLength

int getLength()

getPieceNumber

int getPieceNumber()

getNbBlocks

int getNbBlocks()

getBlockSize

int getBlockSize(int block_index)

getReadCount

short getReadCount()

setReadCount

void setReadCount(short c)

calcNeeded

boolean calcNeeded()

clearNeeded

void clearNeeded()

isNeeded

boolean isNeeded()
Returns:
true if any file the piece covers is neither Do Not Download nor Delete. This is not a real-time indicator. Also, the results are not reliable for pieces that are Done. Use calcNeeded() for guaranteed correct and up to date results
See Also:
calcNeeded(), clearNeeded(), setNeeded(), setNeeded(boolean)

setNeeded

void setNeeded()

setNeeded

void setNeeded(boolean b)

isWritten

boolean isWritten()

getNbWritten

int getNbWritten()

getWritten

boolean[] getWritten()

isWritten

boolean isWritten(int blockNumber)
Parameters:
blockNumber - int
Returns:
true if the given blockNumber has already been written to disk

setWritten

void setWritten(int blockNumber)

setChecking

void setChecking()

isChecking

boolean isChecking()

isNeedsCheck

boolean isNeedsCheck()

spansFiles

boolean spansFiles()

calcDone

boolean calcDone()

isDone

boolean isDone()
Returns:
true when the hash check has passed and the DiskManager has asyncronously updated the Done status. There is nothing further to be done regarding downloading for pieces that are Done.

setDone

void setDone(boolean b)

isInteresting

boolean isInteresting()
Returns:
true if a piece is Needed and not Done

isDownloadable

boolean isDownloadable()
This must not be used to qualify pieces in End Game Mode.

Returns:
true if a piece is Needed but is not fully; Requested, Downloaded, Written, Checking, or Done.

setDownloadable

void setDownloadable()

isSkipped

boolean isSkipped()
returns true if all the files that the piece spans are skipped

Returns:

reDownloadBlock

void reDownloadBlock(int blockNumber)

reset

void reset()

getString

String getString()