Package de.jungblut.partition.Boundaries

Examples of de.jungblut.partition.Boundaries.Range


    // batching, thus only use a single thread.
    Set<Range> partitions = new HashSet<>();
    if (batchSize == 0) {
      numThreads = 1;
      batchSize = inputMatrix.length;
      partitions.add(new Range(0, batchSize - 1));
    } else {
      int offset = 0;
      while (offset < inputMatrix.length) {
        partitions.add(new Range(offset, Math.min(inputMatrix.length - 1,
            offset + (batchSize - 1))));
        offset += batchSize;
      }
    }
    pool = Executors.newFixedThreadPool(stochastic ? 1 : numThreads, factory);
View Full Code Here


    Boundaries partition = new BlockPartitioner().partition(2, 10);
    Set<Range> boundaries = new TreeSet<>(partition.getBoundaries());
    assertEquals(2, boundaries.size());
    Iterator<Range> iterator = boundaries.iterator();

    Range next = iterator.next();
    assertEquals(0, next.getStart());
    assertEquals(4, next.getEnd());
    next = iterator.next();
    assertEquals(5, next.getStart());
    assertEquals(9, next.getEnd());
  }
View Full Code Here

TOP

Related Classes of de.jungblut.partition.Boundaries.Range

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.