📄 seedtopeerratioitem.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: SeedToPeerRatioItem.java
package org.gudy.azureus2.ui.swt.views.tableitems.mytorrents;
import org.gudy.azureus2.core3.download.DownloadManager;
import org.gudy.azureus2.core3.tracker.client.TRTrackerScraperResponse;
import org.gudy.azureus2.core3.util.DisplayFormatters;
import org.gudy.azureus2.plugins.download.Download;
import org.gudy.azureus2.plugins.ui.tables.*;
import org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn;
public class SeedToPeerRatioItem extends CoreTableColumn
implements TableCellRefreshListener
{
public static final Class DATASOURCE_TYPE = org/gudy/azureus2/plugins/download/Download;
public static final String COLUMN_ID = "seed_to_peer_ratio";
public SeedToPeerRatioItem(String sTableID)
{
super(DATASOURCE_TYPE, "seed_to_peer_ratio", 2, 70, sTableID);
setRefreshInterval(-2);
setMinWidthAuto(true);
}
public void fillTableColumnInfo(TableColumnInfo info)
{
info.addCategories(new String[] {
"swarm"
});
info.setProficiency((byte)2);
}
public void refresh(TableCell cell)
{
float ratio = -1F;
DownloadManager dm = (DownloadManager)cell.getDataSource();
if (dm != null)
{
TRTrackerScraperResponse response = dm.getTrackerScrapeResponse();
int seeds;
int peers;
if (response != null && response.isValid())
{
seeds = Math.max(dm.getNbSeeds(), response.getSeeds());
int trackerPeerCount = response.getPeers();
peers = dm.getNbPeers();
if (peers == 0 || trackerPeerCount > peers)
if (trackerPeerCount <= 0)
peers = dm.getActivationCount();
else
peers = trackerPeerCount;
} else
{
seeds = dm.getNbSeeds();
peers = dm.getNbPeers();
}
if (peers < 0 || seeds < 0)
ratio = 0.0F;
else
if (peers == 0)
{
if (seeds == 0)
ratio = 0.0F;
else
ratio = (1.0F / 0.0F);
} else
{
ratio = (float)seeds / (float)peers;
}
}
if (!cell.setSortValue(ratio) && cell.isValid())
return;
if (ratio == -1F)
cell.setText("");
else
if (ratio == 0.0F)
cell.setText("??");
else
cell.setText(DisplayFormatters.formatDecimal(ratio, 3));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -