Brunet.Services.Coordinate.Sample.GetSample C# (CSharp) Метод

GetSample() публичный Метод

public GetSample ( ) : double
Результат double
    public double GetSample() {
      if (_sample_list.Count > MIN_HISTORY_COUNT) {
	ArrayList sorted_samples = new ArrayList(_sample_list);
	sorted_samples.Sort();
	int percentile = (int) (PING_SAMPLE_PERCENTILE * _sample_list.Count);
	double sample = (double) sorted_samples[percentile];
	return sample;
      } else {
	return -1.0f;
      }
    }
  }

Usage Example

Пример #1
0
 /**
  * Returns latency to a neighbor.
  * @param address of the neighbor
  * @returns measured latency
  */
 public double GetMeasuredLatency(Address o_neighbor)
 {
     lock (_sync) {
         if (_samples.ContainsKey(o_neighbor))
         {
             Sample s = (Sample)_samples[o_neighbor];
             return(s.GetSample());
         }
         else
         {
             return(-1.0);
         }
     }
 }
All Usage Examples Of Brunet.Services.Coordinate.Sample::GetSample