org.lastbamboo.common.download
Class MsDState.LibTorrentDownloadingState

java.lang.Object
  extended by org.lastbamboo.common.download.DownloaderState.AbstractRunning
      extended by org.lastbamboo.common.download.MsDState.LibTorrentDownloadingState
All Implemented Interfaces:
DownloaderState, MsDState, MsDState.Downloading, MsDState.LibTorrentDownloading
Enclosing interface:
MsDState

public static class MsDState.LibTorrentDownloadingState
extends DownloaderState.AbstractRunning
implements MsDState.LibTorrentDownloading

An implementation of the LibTorrent downloading state.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.lastbamboo.common.download.MsDState
MsDState.Canceled, MsDState.CanceledImpl, MsDState.Complete, MsDState.CompleteImpl, MsDState.CouldNotDetermineSources, MsDState.CouldNotDetermineSourcesImpl, MsDState.Downloading, MsDState.Failed, MsDState.FailedImpl, MsDState.GettingSources, MsDState.GettingSourcesImpl, MsDState.Idle, MsDState.IdleImpl, MsDState.LibTorrentDownloading, MsDState.LibTorrentDownloadingState, MsDState.LimeWireDownloading, MsDState.LimeWireDownloadingState, MsDState.LittleShootDownloading, MsDState.LittleShootDownloadingState, MsDState.NoSourcesAvailable, MsDState.NoSourcesAvailableImpl, MsDState.Paused, MsDState.PausedImpl, MsDState.Visitor<T>, MsDState.VisitorAdapter<T>
 
Nested classes/interfaces inherited from interface org.lastbamboo.common.download.DownloaderState
DownloaderState.AbstractFailed, DownloaderState.AbstractRunning, DownloaderState.AbstractSucceeded
 
Field Summary
 
Fields inherited from interface org.lastbamboo.common.download.MsDState
CANCELED, COMPLETE, COULD_NOT_DETERMINE_SOURCES, FAILED, GETTING_SOURCES, IDLE, NO_SOURCES_AVAILABLE
 
Constructor Summary
MsDState.LibTorrentDownloadingState(int bytesPerSecond, int numSources, long bytesRead, int numFiles, long maxByte, long size)
          Constructs a new downloading state.
 
Method Summary
<T> T
accept(MsDState.Visitor<T> visitor)
          Accepts a visitor to this state.
 boolean equals(Object obj)
           
 long getBytesRead()
          Accessor for the number of bytes read.
 double getKbs()
          Returns the speed of the download in kilobytes per second.
 long getMaxContiguousByte()
          Returns the maximum contiguous byte we've read for this download.
 int getNumFiles()
          Gets the number of files in this torrent.
 int getNumSources()
          Returns the number of sources used by the download.
 String getTimeRemaining()
          Accessor for the time remaining.
 int hashCode()
           
 
Methods inherited from class org.lastbamboo.common.download.DownloaderState.AbstractRunning
calculateTimeRemaining, getType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.lastbamboo.common.download.DownloaderState
getType
 

Constructor Detail

MsDState.LibTorrentDownloadingState

public MsDState.LibTorrentDownloadingState(int bytesPerSecond,
                                           int numSources,
                                           long bytesRead,
                                           int numFiles,
                                           long maxByte,
                                           long size)
Constructs a new downloading state.

Parameters:
bytesPerSecond - The speed of the download in bytes per second.
numSources - The number of sources used by the download.
bytesRead - The number of bytes read.
maxByte - The maximum contiguous byte we've read.
numFiles - The number of files in the torrent.
Method Detail

accept

public <T> T accept(MsDState.Visitor<T> visitor)
Description copied from interface: MsDState
Accepts a visitor to this state.

Specified by:
accept in interface MsDState
Type Parameters:
T - The return type of the visitor.
Parameters:
visitor - The visitor.
Returns:
The result of the visitation.

getKbs

public double getKbs()
Description copied from interface: MsDState.Downloading
Returns the speed of the download in kilobytes per second.

Specified by:
getKbs in interface MsDState.Downloading
Returns:
The speed of the download in kilobytes per second.

getNumSources

public int getNumSources()
Description copied from interface: MsDState.Downloading
Returns the number of sources used by the download.

Specified by:
getNumSources in interface MsDState.Downloading
Returns:
The number of sources used by the download.

getBytesRead

public long getBytesRead()
Description copied from interface: MsDState.Downloading
Accessor for the number of bytes read.

Specified by:
getBytesRead in interface MsDState.Downloading
Returns:
The number of bytes read.

getMaxContiguousByte

public long getMaxContiguousByte()
Description copied from interface: MsDState.LibTorrentDownloading
Returns the maximum contiguous byte we've read for this download. This is the maximum byte starting from the beginning of the file with no gaps.

Specified by:
getMaxContiguousByte in interface MsDState.LibTorrentDownloading
Returns:
The maximum contiguous byte we've read for this download.

getNumFiles

public int getNumFiles()
Description copied from interface: MsDState.LibTorrentDownloading
Gets the number of files in this torrent.

Specified by:
getNumFiles in interface MsDState.LibTorrentDownloading
Returns:
The number of files in this torrent.

getTimeRemaining

public String getTimeRemaining()
Description copied from interface: MsDState.Downloading
Accessor for the time remaining.

Specified by:
getTimeRemaining in interface MsDState.Downloading
Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2013 LittleShoot. All Rights Reserved.