Package cleo.search.store

Examples of cleo.search.store.StaticDoubleArrayPartition


  public void testMinMaxOnDoubleArrayPartition() {
    double min = Double.MAX_VALUE;
    double max = Double.MIN_VALUE;
   
    // Normal case
    DoubleArrayPartition p = new StaticDoubleArrayPartition(rand.nextInt(1000), 1000);
    for(int i = p.getIndexStart(), end = p.getIndexEnd(); i < end; i++) {
      double val = rand.nextDouble();
      if(val > max) max = val;
      if(val < min) min = val;
      p.set(i, val);
    }
   
    assertEquals(max, Stores.max(p));
    assertEquals(min, Stores.min(p));
   
    // Corner cases
    p = null;
    assertEquals(0d, Stores.max(p));
    assertEquals(0d, Stores.min(p));
   
    p = new StaticDoubleArrayPartition(rand.nextInt(1000), 0);
    assertEquals(0d, Stores.max(p));
    assertEquals(0d, Stores.min(p));
  }
View Full Code Here

TOP

Related Classes of cleo.search.store.StaticDoubleArrayPartition

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.