FileDocCategorySizeDatePackage
SpeedLimitConfidence.javaAPI DocAzureus 3.0.3.45517Wed Aug 01 21:16:08 BST 2007com.aelitis.azureus.core.speedmanager.impl.v2

SpeedLimitConfidence

public class SpeedLimitConfidence extends Object implements Comparable
Created on Jun 5, 2007 Created by Alan Snyder Copyright (C) 2007 Aelitis, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

AELITIS, SAS au capital de 63.529,40 euros 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.

Fields Summary
public static final SpeedLimitConfidence
NONE
public static final SpeedLimitConfidence
LOW
public static final SpeedLimitConfidence
MED
public static final SpeedLimitConfidence
HIGH
public static final SpeedLimitConfidence
ABSOLUTE
private final String
name
private final int
order
private final float
estimateType
private static final String
MESSAGE_BUNDLE_PREFIX
Constructors Summary
private SpeedLimitConfidence(String _name, int _order, float _speedLimitEstimateType)


          
        name = _name;
        order = _order;
        estimateType = _speedLimitEstimateType;
    
Methods Summary
public floatasEstimateType()

        return estimateType;
    
public static java.lang.StringasEstimateTypeString(float type)

        //ToDo: move to proper class. This is to do something now.
        if( type==SpeedManagerLimitEstimate.TYPE_UNKNOWN ){
            return "Unknown";
        }else if( type==SpeedManagerLimitEstimate.TYPE_ESTIMATED){
            return "Estimate";
        }else if( type==SpeedManagerLimitEstimate.TYPE_MANUAL){
            return "Fixed";
        }
        return "";
    
public intcompareTo(java.lang.Object obj)
Comparable interface.

param
obj -
return
-

        if( !(obj instanceof SpeedLimitConfidence)  ){
            throw new ClassCastException("Only comparable to SpeedLimitConfidence class.");
        }
        SpeedLimitConfidence casted = (SpeedLimitConfidence) obj;
        return compareTo(casted);
    
public intcompareTo(com.aelitis.azureus.core.speedmanager.impl.v2.SpeedLimitConfidence limitConf)
Comparable interface

param
limitConf - Item to compare with.
return
-

        return  (order - limitConf.order);
    
public static com.aelitis.azureus.core.speedmanager.impl.v2.SpeedLimitConfidenceconvertType(float type)

        if( type <= SpeedLimitConfidence.NONE.estimateType ){
            return NONE;
        }else if( type <= SpeedLimitConfidence.LOW.estimateType ){
            return LOW;
        }else if( type <= SpeedLimitConfidence.MED.estimateType ){
            return MED;
        }else if( type <= SpeedLimitConfidence.HIGH.estimateType ){
            return HIGH;
        }else{
            return ABSOLUTE;
        }
    
public java.lang.StringgetInternationalizedString()
Get the internationalized string for UI panels and drop downs.

return
- Internationalized String.

                       
      

        return MessageText.getString( MESSAGE_BUNDLE_PREFIX + name.toLowerCase() );
    
public java.lang.StringgetString()

        return name;
    
public booleanisGreater(com.aelitis.azureus.core.speedmanager.impl.v2.SpeedLimitConfidence limitConf)
compareTo to with boolean syntax.

param
limitConf -
return
- true if greater then, false if equal or less.

        if( this.compareTo(limitConf)>0 ){
            return true;
        }
        return false;
    
public static com.aelitis.azureus.core.speedmanager.impl.v2.SpeedLimitConfidenceparseString(java.lang.String setting)
Turns a string into a SpeedLimitConfidence class.

param
setting - String is expected to be one of: NONE, LOW, MED, HIGH, ABSOLUE.
return
- class corresponding to String. If it isn't one of the know values then NONE is returned.

        SpeedLimitConfidence retVal = SpeedLimitConfidence.NONE;

        if(setting==null){
            return retVal;
        }

        if( "NONE".equalsIgnoreCase(setting) ){
            return SpeedLimitConfidence.NONE;
        }else if("LOW".equalsIgnoreCase(setting)){
            return SpeedLimitConfidence.LOW;
        }else if("MED".equalsIgnoreCase(setting)){
            return SpeedLimitConfidence.MED;
        }else if("HIGH".equalsIgnoreCase(setting)){
            return SpeedLimitConfidence.HIGH;
        }else if("ABSOLUTE".equalsIgnoreCase(setting)){
            return SpeedLimitConfidence.ABSOLUTE;
        }

        return retVal;