while(partial.length() < 3) partial = "0" + partial;
_shareRatio = (sr/1000) + "." + partial;
}
DownloadManagerStats stats = manager.getStats();
String swarm_speed = DisplayFormatters.formatByteCountToKiBEtcPerSec( stats.getTotalAverage() ) + " ( " +DisplayFormatters.formatByteCountToKiBEtcPerSec( stats.getTotalAveragePerPeer())+ " " +MessageText.getString("GeneralView.label.averagespeed") + " )";
String swarm_completion = "";
String distributedCopies = "0.000";
String piecesDoneAndSum = ""+manager.getNbPieces();
PEPeerManager pm = manager.getPeerManager();
if( pm != null ) {
int comp = pm.getAverageCompletionInThousandNotation();
if( comp >= 0 ) {
swarm_completion = DisplayFormatters.formatPercentFromThousands( comp );
}
piecesDoneAndSum = pm.getPiecePicker().getNbPiecesDone() + "/" + piecesDoneAndSum;
distributedCopies = new DecimalFormat("0.000").format(pm.getPiecePicker().getMinAvailability()-pm.getNbSeeds()-(pm.isSeeding()&&stats.getDownloadCompleted(false)==1000?1:0));
}
setStats(
DisplayFormatters.formatDownloaded(stats),
DisplayFormatters.formatByteCountToKiBEtc(stats.getTotalDataBytesSent()),
DisplayFormatters.formatByteCountToKiBEtcPerSec(stats.getDataReceiveRate()),
DisplayFormatters.formatByteCountToKiBEtcPerSec(stats.getDataSendRate()),
swarm_speed,
""+manager.getStats().getDownloadRateLimitBytesPerSecond() /1024,
""+(manager.getStats().getUploadRateLimitBytesPerSecond() /1024),
seeds_str,
peers_str,