本文整理汇总了Java中org.gudy.azureus2.core3.config.impl.TransferSpeedValidator类的典型用法代码示例。如果您正苦于以下问题:Java TransferSpeedValidator类的具体用法?Java TransferSpeedValidator怎么用?Java TransferSpeedValidator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransferSpeedValidator类属于org.gudy.azureus2.core3.config.impl包,在下文中一共展示了TransferSpeedValidator类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restoreLimits
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
public void
restoreLimits()
{
String[] params = TransferSpeedValidator.CONFIG_PARAMS;
for (int i=0;i<params.length;i++){
COConfigurationManager.removeParameterListener( params[i], this );
}
plugin.getDownloadManager().removeListener( this );
restoreGlobalLimits();
restoreIndividualLimits();
PluginConfigImpl.setEnablePluginCoreConfigChange( true );
}
示例2: periodicUpdate
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
public void periodicUpdate() {
if (manager == null || stats == null) {
return;
}
int swarms_peer_speed = (int)stats.getTotalSwarmsPeerRate(true,false);
downSpeedGraphic.addIntsValue(
new int[]{ stats.getDataReceiveRate()+stats.getProtocolReceiveRate(),
stats.getProtocolReceiveRate(),
COConfigurationManager.getIntParameter("Max Download Speed KBs") * 1024,
swarms_peer_speed });
upSpeedGraphic.addIntsValue(
new int[]{ stats.getDataSendRate()+stats.getProtocolSendRate(),
stats.getProtocolSendRate(),
COConfigurationManager.getIntParameter(TransferSpeedValidator.getActiveUploadParameter( manager )) * 1024,
swarms_peer_speed });
}
示例3: saveGlobalLimits
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
/**
* Get the global limits from the TransferSpeedValidator class. Call before starting a speed test.
*/
private void saveGlobalLimits(){
//int settings.
maxUploadKbs = COConfigurationManager.getIntParameter( TransferSpeedValidator.UPLOAD_CONFIGKEY );
maxUploadSeedingKbs = COConfigurationManager.getIntParameter( TransferSpeedValidator.UPLOAD_SEEDING_CONFIGKEY );
maxDownloadKbs = COConfigurationManager.getIntParameter( TransferSpeedValidator.DOWNLOAD_CONFIGKEY );
//boolean setting.
autoSpeedEnabled = COConfigurationManager.getBooleanParameter( TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY );
autoSpeedSeedingEnabled = COConfigurationManager.getBooleanParameter( TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY );
LANSpeedEnabled = COConfigurationManager.getBooleanParameter( "LAN Speed Enabled" );
}
示例4: restoreGlobalLimits
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
/**
* Call this method after a speed test completes to restore the global limits.
*/
private void restoreGlobalLimits(){
COConfigurationManager.setParameter( "LAN Speed Enabled", LANSpeedEnabled );
COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY,autoSpeedEnabled);
COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY,autoSpeedSeedingEnabled);
COConfigurationManager.setParameter(TransferSpeedValidator.UPLOAD_CONFIGKEY,maxUploadKbs);
COConfigurationManager.setParameter(TransferSpeedValidator.UPLOAD_SEEDING_CONFIGKEY,maxUploadSeedingKbs);
COConfigurationManager.setParameter(TransferSpeedValidator.DOWNLOAD_CONFIGKEY,maxDownloadKbs);
}
示例5: loadForReset
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
private void
loadForReset()
{
// just maintain the auto upload setting over a reset
auto_up_enabled = COConfigurationManager.getBooleanParameter( TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY );
}
示例6: enableGroups
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
void enableGroups(String strategyListValue){
if(strategyListValue==null){
return;
}
//only enable the comment section if the beta is enabled.
boolean isBothEnabled = COConfigurationManager.getBooleanParameter( TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY );
boolean isSeedingEnabled = COConfigurationManager.getBooleanParameter( TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY );
long version = COConfigurationManager.getLongParameter( SpeedManagerImpl.CONFIG_VERSION );
boolean isV2Enabled = false;
if( (isBothEnabled || isSeedingEnabled) && version==2 ){
isV2Enabled = true;
}
if( commentGroup!=null){
if( isV2Enabled ){
//make this section visible.
commentGroup.setEnabled(true);
commentGroup.setVisible(true);
}else{
//make it invisible.
commentGroup.setEnabled(false);
commentGroup.setVisible(false);
}
}
}
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:28,代码来源:ConfigSectionTransferAutoSpeedBeta.java
示例7: getLimitMenuItemListener
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
/**
* Gets the selection listener of a upload or download limit menu item (including unlimited)
* @param parent The parent menu
* @param configKey The configuration key
* @return The selection listener
*/
private static final Listener getLimitMenuItemListener(final boolean up_menu,
final Menu parent, final GlobalManager globalManager,
final String configKey)
{
return new Listener() {
public void handleEvent(Event event) {
final MenuItem[] items = parent.getItems();
for(int i = 0; i < items.length; i++) {
if(items[i] == event.widget)
{
items[i].setSelection(true);
// turn off auto speed first as this will revert the upload limit to
// what it was before it was turned on
if ( up_menu ){
String configAutoKey =
TransferSpeedValidator.getActiveAutoUploadParameter(globalManager);
COConfigurationManager.setParameter( configAutoKey, false );
}
final int cValue = ((Integer)new TransferSpeedValidator(configKey, (Number)items[i].getData("maxkb")).getValue()).intValue();
COConfigurationManager.setParameter(configKey, cValue);
COConfigurationManager.save();
}
else {
items[i].setSelection(false);
}
}
}
};
}
示例8: periodicUpdate
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
private void periodicUpdate() {
if (stats == null || manager == null) {
return;
}
int swarms_peer_speed = (int) stats.getTotalSwarmsPeerRate(true, false);
upSpeedGraphic.addIntsValue(new int[] {
stats.getDataSendRate() + stats.getProtocolSendRate(),
stats.getProtocolSendRate(),
COConfigurationManager.getIntParameter(TransferSpeedValidator.getActiveUploadParameter(manager)) * 1024,
swarms_peer_speed
});
}
示例9: getDownloadBytesPerSecond
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
protected long
getDownloadBytesPerSecond()
{
long original = (long)capped_download_rate_average.getAverage();
long current = original;
int dl_limit = download_manager.getStats().getDownloadRateLimitBytesPerSecond();
if ( dl_limit > 0 ){
current = Math.min( current, dl_limit );
}
int global_limit = TransferSpeedValidator.getGlobalDownloadRateLimitBytesPerSecond();
if ( global_limit > 0 ){
current = Math.min( current, global_limit );
}
return( current );
}
示例10: saveLimits
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
public void
saveLimits()
{
// a bunch of plugins mess with limits (AutoSpeed, Shaper, SpeedScheduler...) - disable their
// ability to mess with config during the test
PluginConfigImpl.setEnablePluginCoreConfigChange( false );
plugin.getDownloadManager().addListener( this, false );
//preserve the limits for all the downloads and set each to zero.
Download[] d = plugin.getDownloadManager().getDownloads();
if(d!=null){
int len = d.length;
for(int i=0;i<len;i++){
plugin.getDownloadManager().getStats();
int downloadLimit = d[i].getDownloadRateLimitBytesPerSecond();
int uploadLimit = d[i].getUploadRateLimitBytesPerSecond();
setDownloadDetails(d[i],uploadLimit,downloadLimit);
d[i].setUploadRateLimitBytesPerSecond(ZERO_DOWNLOAD_SETTING);
d[i].setDownloadRateLimitBytesPerSecond( ZERO_DOWNLOAD_SETTING );
}
}
//preserve the global limits
saveGlobalLimits();
COConfigurationManager.setParameter( "LAN Speed Enabled", false );
COConfigurationManager.setParameter( TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY,false);
COConfigurationManager.setParameter( TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY,false);
COConfigurationManager.setParameter( TransferSpeedValidator.UPLOAD_CONFIGKEY, max_speed);
COConfigurationManager.setParameter( TransferSpeedValidator.UPLOAD_SEEDING_CONFIGKEY, max_speed);
COConfigurationManager.setParameter( TransferSpeedValidator.DOWNLOAD_CONFIGKEY, max_speed);
String[] params = TransferSpeedValidator.CONFIG_PARAMS;
for (int i=0;i<params.length;i++){
COConfigurationManager.addParameterListener( params[i], this );
}
}
示例11: show
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
/**
*
*/
public void show() {
String title = MessageText.getString("SpeedTestWizard.finish.panel.title");
wizard.setTitle(title);
Composite rootPanel = wizard.getPanel();
GridLayout layout = new GridLayout();
layout.numColumns = 1;
rootPanel.setLayout(layout);
Composite panel = new Composite(rootPanel, SWT.NULL);
GridData gridData = new GridData( GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL );
panel.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 3;
layout.makeColumnsEqualWidth=true;
panel.setLayout(layout);
Label label = new Label(panel, SWT.WRAP);
gridData = new GridData();
gridData.horizontalSpan = 3;
gridData.widthHint = 380;
label.setLayoutData(gridData);
Messages.setLanguageText(label,"SpeedTestWizard.finish.panel.click.close");
//show the setting for upload speed
SpeedManagerLimitEstimate upEst = speedManager.getEstimatedUploadCapacityBytesPerSec();
int maxUploadKbs = upEst.getBytesPerSec()/1024;
SpeedManagerLimitEstimate downEst = speedManager.getEstimatedDownloadCapacityBytesPerSec();
int maxDownloadKbs = downEst.getBytesPerSec()/1024;
//boolean setting.
boolean autoSpeedEnabled = COConfigurationManager.getBooleanParameter( TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY );
boolean autoSpeedSeedingEnabled = COConfigurationManager.getBooleanParameter( TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY );
//spacer 2
Label s2 = new Label(panel, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 3;
s2.setLayoutData(gridData);
String autoSpeed = MessageText.getString("SpeedTestWizard.finish.panel.auto.speed");
createStatusLine(panel, autoSpeed, autoSpeedEnabled);
String autoSpeedWhileSeeding = MessageText.getString("SpeedTestWizard.finish.panel.auto.speed.seeding");
createStatusLine(panel, autoSpeedWhileSeeding, autoSpeedSeedingEnabled);
//spacer 1
Label s1 = new Label(panel, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 3;
s1.setLayoutData(gridData);
//displays a bytes/sec column and a bits/sec column
createHeaderLine(panel);
String maxUploadLbl = MessageText.getString("SpeedView.stats.estupcap");
createDataLine(panel, maxUploadLbl, maxUploadKbs, upEst);
String maxDownloadLbl = MessageText.getString("SpeedView.stats.estdowncap");
createDataLine(panel, maxDownloadLbl, maxDownloadKbs, downEst);
}
示例12: finish
import org.gudy.azureus2.core3.config.impl.TransferSpeedValidator; //导入依赖的package包/类
public void finish() {
wizard.completed = true;
int upLimit = wizard.getUploadLimit();
if (upLimit > 0 ){
COConfigurationManager.setParameter( TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY, false );
COConfigurationManager.setParameter( TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY, false );
COConfigurationManager.setParameter( "Max Upload Speed KBs", upLimit/1024 );
COConfigurationManager.setParameter( "enable.seedingonly.upload.rate", false );
COConfigurationManager.setParameter( "max active torrents",wizard.maxActiveTorrents);
COConfigurationManager.setParameter( "max downloads",wizard.maxDownloads);
try{
SpeedManager sm = AzureusCoreFactory.getSingleton().getSpeedManager();
boolean is_manual = wizard.isUploadLimitManual();
sm.setEstimatedUploadCapacityBytesPerSec( upLimit, is_manual?SpeedManagerLimitEstimate.TYPE_MANUAL:SpeedManagerLimitEstimate.TYPE_MEASURED );
}catch( Throwable e ){
Debug.out( e );
}
// toggle to ensure listeners get the message that they should recalc things
COConfigurationManager.setParameter( "Auto Adjust Transfer Defaults", false );
COConfigurationManager.setParameter( "Auto Adjust Transfer Defaults", true );
}
if ( wizard.getWizardMode() != ConfigureWizard.WIZARD_MODE_FULL ){
wizard.close();
}else{
COConfigurationManager.setParameter("TCP.Listen.Port",wizard.serverTCPListenPort);
COConfigurationManager.setParameter("UDP.Listen.Port",wizard.serverUDPListenPort);
COConfigurationManager.setParameter("UDP.NonData.Listen.Port",wizard.serverUDPListenPort);
COConfigurationManager.setParameter("General_sDefaultTorrent_Directory",wizard.torrentPath);
if ( wizard.hasDataPathChanged()){
COConfigurationManager.setParameter( "Default save path", wizard.getDataPath());
}
COConfigurationManager.setParameter("Wizard Completed",true);
COConfigurationManager.save();
wizard.switchToClose();
}
}