com.aelitis.azureus.plugins.startstoprules.defaultplugin
Class DefaultRankCalculator

java.lang.Object
  extended by com.aelitis.azureus.plugins.startstoprules.defaultplugin.DefaultRankCalculator
All Implemented Interfaces:
Comparable, DownloadManagerStateAttributeListener

public class DefaultRankCalculator
extends Object
implements DownloadManagerStateAttributeListener, Comparable

Author:
TuxPaper

Field Summary
protected  Download dl
           
static int DOWNLOAD_ORDER_INDEX
           
static int DOWNLOAD_ORDER_SEED_COUNT
           
static int DOWNLOAD_ORDER_SPEED
           
static int FIRSTPRIORITY_ALL
          All of the First Priority rules must match
static int FIRSTPRIORITY_ANY
          Any of the First Priority rules must match
protected static int iRankType
          Ranking System to use
 String sExplainFP
          Public for tooltip to access it
 String sExplainSR
          Public for tooltip to access it
static int SR_0PEERS
          Seeding Rank value when download is marked as 0 Peers
static int SR_COMPLETE_STARTS_AT
          Rank that complete starts at (and incomplete ends at + 1)
static int SR_FP_SPRATIOMET
          Seeding Rank value when download is marked as S:P Ratio Met for FP
static int SR_FP0PEERS
          Seeding Rank value when download is marked as 0 Peers and FP
static int SR_IGNORED_LESS_THAN
          Ranks below this value are for torrents to be ignored (moved to bottom & queued)
static String[] SR_NEGATIVE_DEBUG
           
static int SR_NOTQUEUED
          Seeding Rank value when download is marked as not queued
static int SR_NUMSEEDSMET
          Seeding Rank value when download is marked as # Seeds Met
static int SR_RATIOMET
          Seeding Rank value when download is marked as P:1S Ratio Met
static int SR_SHARERATIOMET
          Seeding Rank value when download is marked as Share Ratio Met
static int SR_TIMED_QUEUED_ENDS_AT
          Maximimum ranking for time queue mode.
 String sTrace
          Public for tooltip to access it
 
Fields inherited from interface org.gudy.azureus2.core3.download.DownloadManagerStateAttributeListener
WILL_BE_READ, WRITTEN
 
Constructor Summary
DefaultRankCalculator(StartStopRulesDefaultPlugin _rules, Download _dl)
          Default Initializer
 
Method Summary
 void attributeEventOccurred(DownloadManager download, String attribute, int event_type)
           
 boolean changeChecker()
          Check Seeders for various changes not triggered by listeners
 int compareTo(Object obj)
          Sort first by SeedingRank Descending, then by Position Ascending.
protected  void destroy()
           
 boolean getActivelyDownloading()
          Retrieves whether the torrent is "actively" downloading
 boolean getActivelySeeding()
          Retrieves whether the torrent is "actively" seeding
 boolean getCachedIsFP()
           
 int getDLRLastTestSpeed()
           
 long getDLRLastTestTime()
           
 String getDLRTrace()
           
 Download getDownloadObject()
           
 boolean isFirstPriority()
          Does the torrent match First Priority criteria?
 boolean isForceActive()
           
 boolean isQueued()
           
 int recalcSeedingRank()
          Assign Seeding Rank based on RankType
static void reloadConfigParams(PluginConfig cfg)
          Load config values into the static variables
 void setDLRActive(long time)
           
 void setDLRComplete(long time)
           
 void setDLRInactive()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIRSTPRIORITY_ALL

public static final int FIRSTPRIORITY_ALL
All of the First Priority rules must match

See Also:
Constant Field Values

FIRSTPRIORITY_ANY

public static final int FIRSTPRIORITY_ANY
Any of the First Priority rules must match

See Also:
Constant Field Values

DOWNLOAD_ORDER_INDEX

public static final int DOWNLOAD_ORDER_INDEX
See Also:
Constant Field Values

DOWNLOAD_ORDER_SEED_COUNT

public static final int DOWNLOAD_ORDER_SEED_COUNT
See Also:
Constant Field Values

DOWNLOAD_ORDER_SPEED

public static final int DOWNLOAD_ORDER_SPEED
See Also:
Constant Field Values

SR_COMPLETE_STARTS_AT

public static final int SR_COMPLETE_STARTS_AT
Rank that complete starts at (and incomplete ends at + 1)

See Also:
Constant Field Values

SR_TIMED_QUEUED_ENDS_AT

public static final int SR_TIMED_QUEUED_ENDS_AT
Maximimum ranking for time queue mode. 1 unit is a second

See Also:
Constant Field Values

SR_IGNORED_LESS_THAN

public static final int SR_IGNORED_LESS_THAN
Ranks below this value are for torrents to be ignored (moved to bottom & queued)

See Also:
Constant Field Values

SR_NOTQUEUED

public static final int SR_NOTQUEUED
Seeding Rank value when download is marked as not queued

See Also:
Constant Field Values

SR_FP_SPRATIOMET

public static final int SR_FP_SPRATIOMET
Seeding Rank value when download is marked as S:P Ratio Met for FP

See Also:
Constant Field Values

SR_RATIOMET

public static final int SR_RATIOMET
Seeding Rank value when download is marked as P:1S Ratio Met

See Also:
Constant Field Values

SR_NUMSEEDSMET

public static final int SR_NUMSEEDSMET
Seeding Rank value when download is marked as # Seeds Met

See Also:
Constant Field Values

SR_FP0PEERS

public static final int SR_FP0PEERS
Seeding Rank value when download is marked as 0 Peers and FP

See Also:
Constant Field Values

SR_0PEERS

public static final int SR_0PEERS
Seeding Rank value when download is marked as 0 Peers

See Also:
Constant Field Values

SR_SHARERATIOMET

public static final int SR_SHARERATIOMET
Seeding Rank value when download is marked as Share Ratio Met

See Also:
Constant Field Values

SR_NEGATIVE_DEBUG

public static final String[] SR_NEGATIVE_DEBUG

iRankType

protected static int iRankType
Ranking System to use


dl

protected final Download dl

sExplainFP

public String sExplainFP
Public for tooltip to access it


sExplainSR

public String sExplainSR
Public for tooltip to access it


sTrace

public String sTrace
Public for tooltip to access it

Constructor Detail

DefaultRankCalculator

public DefaultRankCalculator(StartStopRulesDefaultPlugin _rules,
                             Download _dl)
Default Initializer

Parameters:
_rules -
_dl -
Method Detail

attributeEventOccurred

public void attributeEventOccurred(DownloadManager download,
                                   String attribute,
                                   int event_type)
Specified by:
attributeEventOccurred in interface DownloadManagerStateAttributeListener

destroy

protected void destroy()

reloadConfigParams

public static void reloadConfigParams(PluginConfig cfg)
Load config values into the static variables

Parameters:
cfg -

compareTo

public int compareTo(Object obj)
Sort first by SeedingRank Descending, then by Position Ascending.

Specified by:
compareTo in interface Comparable

getDownloadObject

public Download getDownloadObject()

isForceActive

public boolean isForceActive()

isQueued

public boolean isQueued()

getActivelyDownloading

public boolean getActivelyDownloading()
Retrieves whether the torrent is "actively" downloading

Returns:
true: actively downloading

getActivelySeeding

public boolean getActivelySeeding()
Retrieves whether the torrent is "actively" seeding

Returns:
true: actively seeding

recalcSeedingRank

public int recalcSeedingRank()
Assign Seeding Rank based on RankType

Returns:
New Seeding Rank Value

isFirstPriority

public boolean isFirstPriority()
Does the torrent match First Priority criteria?

Returns:
FP State

getCachedIsFP

public boolean getCachedIsFP()
Returns:
last calculated FP state

setDLRInactive

public void setDLRInactive()

setDLRActive

public void setDLRActive(long time)

setDLRComplete

public void setDLRComplete(long time)

getDLRLastTestTime

public long getDLRLastTestTime()

getDLRLastTestSpeed

public int getDLRLastTestSpeed()

getDLRTrace

public String getDLRTrace()

toString

public String toString()
Overrides:
toString in class Object

changeChecker

public boolean changeChecker()
Check Seeders for various changes not triggered by listeners

Returns:
True: something changed