Methods Summary |
---|
public void | addPingTime(int ping)
currPing = (double) ping;
shortTerm.update( (double)ping );
medTerm.update( (double)ping );
longTerm.update( (double)ping );
|
public com.aelitis.azureus.core.util.average.Average | getHistory()Get the average that should be used for checking ping times.
return forChecks;
|
public com.aelitis.azureus.core.util.average.Average | getLongTermAve()Get the long-term average.
return longTerm;
|
public int | getTrend()Speculative method to see if it can determine a trend. The larger the number
the stronger the trend.
int retVal = 0;
//based on current ping values.
if(currPing<0.0){
retVal--;
}else{
if( currPing < shortTerm.getAverage() ){
retVal++;
}else{
retVal--;
}
if( currPing < medTerm.getAverage() ){
retVal++;
}else{
retVal--;
}
if( currPing < longTerm.getAverage() ){
retVal++;
}else{
retVal--;
}
}
//compare shortTerm and medium term averages.
if(shortTerm.getAverage() < medTerm.getAverage() ){
retVal++;
}else{
retVal--;
}
//compare short-term with long term.
if(shortTerm.getAverage() < longTerm.getAverage() ){
retVal++;
}else{
retVal--;
}
//compare medium-term with long-term.
if(medTerm.getAverage() < longTerm.getAverage() ){
retVal++;
}else{
retVal--;
}
//modify results based on absolute ping values.
final int ABSOLUTE_GOOD_PING_VALUE = 30;
if(currPing<ABSOLUTE_GOOD_PING_VALUE){
retVal++;
}
if(shortTerm.getAverage()<ABSOLUTE_GOOD_PING_VALUE){
retVal++;
}
if(medTerm.getAverage()<ABSOLUTE_GOOD_PING_VALUE){
retVal++;
}
if(longTerm.getAverage()<ABSOLUTE_GOOD_PING_VALUE){
retVal++;
}
//modify results based on absolute ping values that are too long.
final int ABSOLUTE_BAD_PING_VALUE = 300;
if(currPing>ABSOLUTE_BAD_PING_VALUE){
retVal--;
}
if(shortTerm.getAverage()>ABSOLUTE_BAD_PING_VALUE){
retVal--;
}
if(medTerm.getAverage()>ABSOLUTE_BAD_PING_VALUE){
retVal--;
}
if(longTerm.getAverage()>ABSOLUTE_BAD_PING_VALUE){
retVal--;
}
return retVal;
|
public void | madeChange()
//want to make all the values NAN until it is ready to compare again.
|