Package com.aelitis.azureus.core.util.average

Examples of com.aelitis.azureus.core.util.average.Average


       
        Object[]  a_entry = (Object[])ave.get( key );
       
        if ( a_entry != null ){
         
          Average  average = (Average)a_entry[0];
         
          ave_results.put( key + ".average", new Long((long)average.getAverage()));
        }
      }
           
      result.putAll( ave_results );
    }
View Full Code Here


                Object  value   = entry.getValue();
               
                if ( value instanceof Long ){
                 
                  long  last_value;
                  Average  a;
                  boolean  new_average;
                 
                  Object[] a_entry = (Object[])ave.get( key );
                 
                  if ( a_entry == null ){
 
                    a       = AverageFactory.MovingImmediateAverage( 10 );
                    last_value  = 0;
                   
                    a_entry = new Object[]{ a, value };
                   
                    ave.put( key, a_entry );
                   
                    new_averages = new_average = true;
                   
                  }else{
                    a      = (Average)a_entry[0];
                    last_value  = ((Long)a_entry[1]).longValue();
                   
                    new_average = false;
                  }
                 
                  if ( stats_types.get( key ) == CUMULATIVE ){
                 
                      // skip initial value as 'last_value' is invalid
                   
                    if ( !new_average ){
                   
                      a.update(((Long)value).longValue() - last_value);
                    }
                  }else{
                   
                    a.update(((Long)value).longValue());

                  }
                 
                  a_entry[1] = value;
                }
View Full Code Here

        double fastestPing = 10000.0;

        int len = sources.length;
        for(int i=0; i<len; i++){
            PingSourceStats pss = (PingSourceStats) pingAverages.get(sources[i]);
            Average ave = pss.getHistory();
            double pingTime = ave.getAverage();

            //find slowest
            if( pingTime>slowestPing ){
                slowestPing = pingTime;
                slowestSource=sources[i];
View Full Code Here

        double fastB = 10000.0;
        double slowest = 0.0;
        int len = sources.length;
        for(int i=0; i<len; i++){
            PingSourceStats pss = (PingSourceStats) pingAverages.get(sources[i]);
            Average ave = pss.getHistory();
            double pingTime = ave.getAverage();

            //determine fastest or second fastest.
            if(pingTime<fastA){
                fastB=fastA;
                fastA=pingTime;
View Full Code Here

            PingSourceStats pss = (PingSourceStats) pingAverages.get(sources[i]);
           
            if ( pss == null ){
              continue;
            }
            Average a = pss.getLongTermAve();
            double avePingTime = a.getAverage();

            //is this a new highest value?
            if( avePingTime>highestLongTermPing ){
                highestLongTermPing = avePingTime;
                highestSource = sources[i];
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.core.util.average.Average

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.