Class PiecesViewBase.PEPieceUploading

java.lang.Object
com.biglybt.ui.swt.views.PiecesViewBase.PEPieceUploading
All Implemented Interfaces:
PEPiece
Enclosing class:
PiecesViewBase

public class PiecesViewBase.PEPieceUploading extends Object implements PEPiece
  • Field Details

    • pm

      private final PEPeerManager pm
    • dm_piece

      private final DiskManagerPiece dm_piece
    • piece_number

      private final int piece_number
    • blocks

      private final boolean[] blocks
    • peers

      private final CopyOnWriteSet<String> peers
    • complete

      private boolean complete
    • last_active

      private volatile long last_active
  • Constructor Details

  • Method Details

    • getPiecePicker

      public PiecePicker getPiecePicker()
      Specified by:
      getPiecePicker in interface PEPiece
    • getManager

      public PEPeerManager getManager()
      Specified by:
      getManager in interface PEPiece
    • getDMPiece

      public DiskManagerPiece getDMPiece()
      Specified by:
      getDMPiece in interface PEPiece
    • getPieceNumber

      public int getPieceNumber()
      Specified by:
      getPieceNumber in interface PEPiece
    • getLength

      public int getLength()
      Specified by:
      getLength in interface PEPiece
    • getNbBlocks

      public int getNbBlocks()
      Specified by:
      getNbBlocks in interface PEPiece
    • getBlockNumber

      public int getBlockNumber(int offset)
      Specified by:
      getBlockNumber in interface PEPiece
      Parameters:
      offset - int bytes into piece
      Returns:
      block int number corresponding to given offset
    • getBlockSize

      public int getBlockSize(int block_index)
      Specified by:
      getBlockSize in interface PEPiece
    • addUploading

      private void addUploading(boolean[] b, Set<String> latest_peers)
    • readyToRemove

      private boolean readyToRemove()
    • getUploadPeers

      public CopyOnWriteSet<String> getUploadPeers()
    • getCreationTime

      public long getCreationTime()
      Description copied from interface: PEPiece
      The time the pePiece was [re]created
      Specified by:
      getCreationTime in interface PEPiece
    • getTimeSinceLastActivity

      public long getTimeSinceLastActivity()
      Description copied from interface: PEPiece
      How many ms since a write to the piece, or since the piece was created if no last write time is known. The return value will be 0 when there's no writes and the piece is new.
      Specified by:
      getTimeSinceLastActivity in interface PEPiece
      Returns:
      long
    • getLastDownloadTime

      public long getLastDownloadTime(long now)
      Specified by:
      getLastDownloadTime in interface PEPiece
    • addWrite

      public void addWrite(int blockNumber, String sender, byte[] hash, boolean correct)
      Description copied from interface: PEPiece
      record details of a piece's blocks that have been completed for bad peer detection purposes
      Specified by:
      addWrite in interface PEPiece
      Parameters:
      blockNumber -
      sender -
      hash -
      correct -
    • getNbWritten

      public int getNbWritten()
      Specified by:
      getNbWritten in interface PEPiece
    • getAvailability

      public int getAvailability()
      Specified by:
      getAvailability in interface PEPiece
    • hasUnrequestedBlock

      public boolean hasUnrequestedBlock()
      Specified by:
      hasUnrequestedBlock in interface PEPiece
    • getAndMarkBlocks

      public int[] getAndMarkBlocks(PEPeer peer, int nbWanted, int[] request_hint, boolean reverse_order)
      Specified by:
      getAndMarkBlocks in interface PEPiece
    • getAndMarkBlock

      public void getAndMarkBlock(PEPeer peer, int index)
      Specified by:
      getAndMarkBlock in interface PEPiece
    • getRealTimeData

      public Object getRealTimeData()
      Specified by:
      getRealTimeData in interface PEPiece
    • setRealTimeData

      public void setRealTimeData(Object o)
      Specified by:
      setRealTimeData in interface PEPiece
    • setRequested

      public boolean setRequested(PEPeer peer, int blockNumber)
      Specified by:
      setRequested in interface PEPiece
    • clearRequested

      public void clearRequested(int blocNumber)
      Specified by:
      clearRequested in interface PEPiece
    • isRequested

      public boolean isRequested(int blockNumber)
      Specified by:
      isRequested in interface PEPiece
    • isRequested

      public boolean isRequested()
      Specified by:
      isRequested in interface PEPiece
    • setRequested

      public void setRequested()
      Specified by:
      setRequested in interface PEPiece
    • isRequestable

      public boolean isRequestable()
      Specified by:
      isRequestable in interface PEPiece
    • getNbRequests

      public int getNbRequests()
      Specified by:
      getNbRequests in interface PEPiece
    • getNbUnrequested

      public int getNbUnrequested()
      Specified by:
      getNbUnrequested in interface PEPiece
    • isDownloaded

      public boolean isDownloaded(int blockNumber)
      Specified by:
      isDownloaded in interface PEPiece
    • setDownloaded

      public void setDownloaded(int offset)
      Specified by:
      setDownloaded in interface PEPiece
    • clearDownloaded

      public void clearDownloaded(int offset)
      Specified by:
      clearDownloaded in interface PEPiece
    • isDownloaded

      public boolean isDownloaded()
      Specified by:
      isDownloaded in interface PEPiece
    • getDownloaded

      public boolean[] getDownloaded()
      Specified by:
      getDownloaded in interface PEPiece
    • hasUndownloadedBlock

      public boolean hasUndownloadedBlock()
      Specified by:
      hasUndownloadedBlock in interface PEPiece
    • getReservedBy

      public String getReservedBy()
      Specified by:
      getReservedBy in interface PEPiece
    • setReservedBy

      public void setReservedBy(String peer)
      Specified by:
      setReservedBy in interface PEPiece
    • getResumePriority

      public int getResumePriority()
      Specified by:
      getResumePriority in interface PEPiece
      Returns:
      int ResumePriority (startPriority + resuming adjustments)
    • setResumePriority

      public void setResumePriority(int p)
      Specified by:
      setResumePriority in interface PEPiece
      Parameters:
      p - the Resume Priority to set, for display purposes
    • getWriters

      public String[] getWriters()
      Specified by:
      getWriters in interface PEPiece
    • setWritten

      public void setWritten(String peer, int blockNumber)
      Specified by:
      setWritten in interface PEPiece
    • isWritten

      public boolean isWritten()
      Specified by:
      isWritten in interface PEPiece
    • isWritten

      public boolean isWritten(int blockNumber)
      Specified by:
      isWritten in interface PEPiece
    • getSpeed

      public int getSpeed()
      Specified by:
      getSpeed in interface PEPiece
    • setSpeed

      public void setSpeed(int speed)
      Specified by:
      setSpeed in interface PEPiece
    • setLastRequestedPeerSpeed

      public void setLastRequestedPeerSpeed(int speed)
      Specified by:
      setLastRequestedPeerSpeed in interface PEPiece
    • reset

      public void reset()
      Specified by:
      reset in interface PEPiece
    • getString

      public String getString()
      Specified by:
      getString in interface PEPiece