private AggregatorFactory[] getCombiningFactories(AggregatorFactory[] aggregatorFactories) { final AggregatorFactory[] combiningFactories = new AggregatorFactory[aggregatorFactories.length]; Arrays.setAll(combiningFactories, i -> aggregatorFactories[i].getCombiningFactory()); return combiningFactories; } }
public Page getPositions(int[] retainedPositions, int offset, int length) { requireNonNull(retainedPositions, "retainedPositions is null"); Block[] blocks = new Block[this.blocks.length]; Arrays.setAll(blocks, i -> this.blocks[i].getPositions(retainedPositions, offset, length)); return new Page(length, blocks); }
public Page getPositions(int[] retainedPositions, int offset, int length) { requireNonNull(retainedPositions, "retainedPositions is null"); Block[] blocks = new Block[this.blocks.length]; Arrays.setAll(blocks, i -> this.blocks[i].getPositions(retainedPositions, offset, length)); return new Page(length, blocks); }
private EventPublisher[] initializePublisherThreads(int publisherThreadCount, Executor executor, TransactionManager transactionManager, RollbackConfiguration rollbackConfiguration) { EventPublisher[] publishers = new EventPublisher[publisherThreadCount]; Arrays.setAll(publishers, t -> new EventPublisher(executor, transactionManager, rollbackConfiguration, t)); return publishers; }
private CommandHandlerInvoker[] initializeInvokerThreads(int invokerThreadCount, Cache cache) { CommandHandlerInvoker[] invokers = new CommandHandlerInvoker[invokerThreadCount]; Arrays.setAll(invokers, t -> new CommandHandlerInvoker(cache, t)); return invokers; }
public Iterator<Page> getSortedPages() { return new AbstractIterator<Page>() { private int currentPosition; private final PageBuilder pageBuilder = new PageBuilder(types); private final int[] outputChannels = new int[types.size()]; { Arrays.setAll(outputChannels, IntUnaryOperator.identity()); } @Override public Page computeNext() { currentPosition = buildPage(currentPosition, outputChannels, pageBuilder); if (pageBuilder.isEmpty()) { return endOfData(); } Page page = pageBuilder.build(); pageBuilder.reset(); return page; } }; } }
private static Page somePage(List<Type> types) { int[] initialValues = new int[types.size()]; Arrays.setAll(initialValues, i -> 100 * i); return createSequencePage(types, 7, initialValues); } }
private static DictionaryBlock createDictionaryBlockWithFailure(int dictionarySize, int blockSize) { Block dictionary = createLongSequenceBlock(-10, dictionarySize - 10); int[] ids = new int[blockSize]; Arrays.setAll(ids, index -> index % dictionarySize); return new DictionaryBlock(dictionary, ids); }
private static DictionaryBlock createDictionaryBlockWithUnusedEntries(int dictionarySize, int blockSize) { Block dictionary = createLongSequenceBlock(-10, dictionarySize); int[] ids = new int[blockSize]; Arrays.setAll(ids, index -> (index % dictionarySize) + 10); return new DictionaryBlock(dictionary, ids); }
private static DictionaryBlock createDictionaryBlock(int dictionarySize, int blockSize) { Block dictionary = createLongSequenceBlock(0, dictionarySize); int[] ids = new int[blockSize]; Arrays.setAll(ids, index -> index % dictionarySize); return new DictionaryBlock(dictionary, ids); }
private static DictionaryBlock createDictionaryBlockWithFailure(int dictionarySize, int blockSize) { Block dictionary = createLongSequenceBlock(-10, dictionarySize - 10); int[] ids = new int[blockSize]; Arrays.setAll(ids, index -> index % dictionarySize); return new DictionaryBlock(dictionary, ids); }
private static DictionaryBlock createDictionaryBlock(int dictionarySize, int blockSize) { Block dictionary = createLongSequenceBlock(0, dictionarySize); int[] ids = new int[blockSize]; Arrays.setAll(ids, index -> index % dictionarySize); return new DictionaryBlock(dictionary, ids); }
private static DictionaryBlock createDictionaryBlockWithUnusedEntries(int dictionarySize, int blockSize) { Block dictionary = createLongSequenceBlock(-10, dictionarySize); int[] ids = new int[blockSize]; Arrays.setAll(ids, index -> (index % dictionarySize) + 10); return new DictionaryBlock(dictionary, ids); }
public MultiQueuePolicy(Config config) { MultiQueueSettings settings = new MultiQueueSettings(config); policyStats = new PolicyStats("linked.MultiQueue"); threshold = new long[settings.numberOfQueues()]; headQ = new Node[settings.numberOfQueues()]; out = new Long2ObjectLinkedOpenHashMap<>(); data = new Long2ObjectOpenHashMap<>(); maximumSize = settings.maximumSize(); lifetime = settings.lifetime(); Arrays.setAll(headQ, Node::sentinel); Arrays.setAll(threshold, i -> 1L << i); maxOut = (int) (maximumSize * settings.percentOut()); }
public S4WindowTinyLfuPolicy(double percentMain, S4WindowTinyLfuSettings settings) { String name = String.format("sketch.S4WindowTinyLfu (%.0f%%)", 100 * (1.0d - percentMain)); this.policyStats = new PolicyStats(name); this.admittor = new TinyLfu(settings.config(), policyStats); this.maximumSize = settings.maximumSize(); this.maxMain = (int) (maximumSize * percentMain); this.maxEden = maximumSize - maxMain; this.data = new Long2ObjectOpenHashMap<>(); this.headEden = Node.sentinel(-1); this.levels = settings.levels(); this.sizeMainQ = new int[levels]; this.headMainQ = new Node[levels]; Arrays.setAll(headMainQ, Node::sentinel); }
@Override public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] means = new double[sketch.getNumValues()]; Arrays.setAll(means, i -> stats[i].getMean()); return means; }
@Override public double[] compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } final double[] variances = new double[sketch.getNumValues()]; Arrays.setAll(variances, i -> stats[i].getVariance()); return variances; }
private static SummaryStatistics[] getStats(final ArrayOfDoublesSketch sketch) { final SummaryStatistics[] stats = new SummaryStatistics[sketch.getNumValues()]; Arrays.setAll(stats, i -> new SummaryStatistics()); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { final double[] values = it.getValues(); for (int i = 0; i < values.length; i++) { stats[i].addValue(values[i]); } } return stats; }
public S4LruPolicy(Admission admission, Config config) { this.policyStats = new PolicyStats(admission.format("linked.S4Lru")); this.admittor = admission.from(config, policyStats); S4LruSettings settings = new S4LruSettings(config); this.data = new Long2ObjectOpenHashMap<>(); this.maximumSize = settings.maximumSize(); this.levels = settings.levels(); this.headQ = new Node[levels]; this.sizeQ = new int[levels]; Arrays.setAll(headQ, Node::sentinel); }
/** {@inheritDoc} */ @Override public Vector map(IgniteDoubleFunction<Double> fun) { if (sto.isArrayBased()) { double[] data = sto.data(); Arrays.setAll(data, (idx) -> fun.apply(data[idx])); } else { int len = size(); for (int i = 0; i < len; i++) storageSet(i, fun.apply(storageGet(i))); } return this; }