Package cleo.search.store

Examples of cleo.search.store.StaticFloatArrayPartition


   
    logger.info(name + " started.");
  }

  protected FloatArrayPartition initScoreStore() {
    FloatArrayPartition p = new StaticFloatArrayPartition(elementStore.getIndexStart(), elementStore.capacity());
   
    try {
      if(scoreScanner != null) {
        long startTime = System.currentTimeMillis();
       
        ElementScoreHandler handler = new ElementScoreHandler(p);
        scoreScanner.scan(handler);
       
        for(int i = p.getIndexStart(), end = p.getIndexEnd(); i < end; i++) {
          float score = p.get(i);
          if(score < Score.MIN_SCORE_FLOAT) {
            score = Score.MIN_SCORE_FLOAT;
            p.set(i, score);
          }
         
          if(score > Score.MIN_SCORE_FLOAT && elementStore.hasIndex(i)) {
            E element = elementStore.getElement(i);
            if(element != null) {
View Full Code Here


  public void testMinMaxOnFloatArrayPartition() {
    float min = Float.MAX_VALUE;
    float max = Float.MIN_VALUE;
   
    // Normal case
    FloatArrayPartition p = new StaticFloatArrayPartition(rand.nextInt(1000), 1000);
    for(int i = p.getIndexStart(), end = p.getIndexEnd(); i < end; i++) {
      float val = rand.nextFloat();
      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(0f, Stores.max(p));
    assertEquals(0f, Stores.min(p));
   
    p = new StaticFloatArrayPartition(rand.nextInt(1000), 0);
    assertEquals(0f, Stores.max(p));
    assertEquals(0f, Stores.min(p));
  }
View Full Code Here

TOP

Related Classes of cleo.search.store.StaticFloatArrayPartition

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.