@Override // This method is only used when we do not know the element type at compile time, so it has to box the elements public Iterator<VirtualRelationshipValue> iterator() { return inner.mapToObj( (LongFunction<VirtualRelationshipValue>) VirtualValues::relationship ).iterator(); }
@Override // This method is only used when we do not know the element type at compile time, so it has to box the elements public Iterator<VirtualNodeValue> iterator() { return inner.mapToObj( (LongFunction<VirtualNodeValue>) VirtualValues::node ).iterator(); }
public LongMapToObjAction(LongFunction<? extends U> mapper) { super(s -> s.mapToObj(requireNonNull(mapper)), Stream.class, MAP_TO); }
/** * Returns all updates in the specified range of versions. * * @param startVer Lower bound (inclusive). * @param actualVer Upper bound (inclusive). * @return Array with all requested updates sorted by version in ascending order. */ private DistributedMetaStorageHistoryItem[] history(long startVer, long actualVer) { return LongStream.rangeClosed(startVer, actualVer) .mapToObj(this::historyItem) .toArray(DistributedMetaStorageHistoryItem[]::new); }
@Override public <U> Stream<U> mapToObj(LongFunction<? extends U> mapper) { requireNonNull(mapper); if (STRICT) { return toStream().mapToObj(mapper); } return SingletonStream.of(mapper.apply(element)); }
@SafeVarargs @SuppressWarnings("varargs") // Creating a List from an array is safe public static <T> Stream<Stream<T>> of(final T... items) { final List<T> itemList = Arrays.asList(items); return LongStream.range(0, factorial(items.length)) .mapToObj(no -> permutation(no, itemList).stream()); }
@Override public Stream<R> build(boolean parallel) { return previous().build(parallel).mapToObj(mapper); } }
@Override public <U> Stream<U> mapToObj(LongFunction<? extends U> mapper) { return wrap(stream().mapToObj(mapper)); }
@Override public String toString() { return "requestCategories = " + getRequestCategories().toString() + "\ntiming = " + getTiming().toString() + "\nntimingMin = " + getTimingMin().toString() + "\nntimingMax = " + getTimingMax().toString() + "\nntimingAvg = " + getTimingAvg().toString() + "\nminutes = " + getMinutes() + "\nrequests = " + getRequests() + "\nrequestsPerMinute = " + getRequestsPerMinute() + "\nrequestsPerMinuteMin = " + getRequestsPerMinuteMin() + "\nrequestsPerMinuteMax = " + getRequestsPerMinuteMax() + "\nrequestsPerMinuteAvg = " + getRequestsPerMinuteAvg() + "\ndayHistogram = " + LongStream.of(getDayHistogram()).mapToObj(a -> Long.toString(a)).map(a -> a.toString()).collect(Collectors.joining(", ")) + "\nmonthHistogram = " + LongStream.of(getMonthHistogram()).mapToObj(a -> Long.toString(a)).map(a -> a.toString()).collect(Collectors.joining(", ")); } }
private static boolean handleComponent(Relations relations, Select.Row row, SqlStatement update) throws SQLException { String componentUuid = row.getString(1); String rootComponentUuid = row.getString(2); if (componentUuid.equals(rootComponentUuid)) { // Root component, no need to use the table SNAPSHOTS. // Moreover it allows to support provisioned projects (zero analysis) update.setString(1, PATH_SEPARATOR); update.setString(2, componentUuid); return true; } Snapshot snapshot = relations.snapshotsByComponentUuid.get(componentUuid); if (snapshot == null) { LOG.trace("No UUID found for component UUID={}", componentUuid); return false; } List<String> componentUuidPath = Arrays.stream(snapshot.snapshotPath) .mapToObj(relations.snapshotsById::get) .filter(Objects::nonNull) .map(s -> s.componentUuid) .collect(toCollection(ArrayList::new)); if (componentUuidPath.size() != snapshot.snapshotPath.length) { LOG.trace("Some component UUIDs not found for snapshots [{}]", snapshot.snapshotPath); return false; } update.setString(1, PATH_SEPARATOR + PATH_JOINER.join(componentUuidPath) + PATH_SEPARATOR); update.setString(2, componentUuid); return true; }
public static NodeValue[] nodes( long... ids ) { return Arrays.stream( ids ) .mapToObj( id -> nodeValue( id, stringArray( "L" ), emptyMap() ) ) .toArray( NodeValue[]::new ); }
private void removeOldNodes( LongStream idRange ) { try ( Transaction transaction = database.beginTx() ) { idRange.mapToObj( id -> database.getNodeById( id ) ).forEach( Node::delete ); transaction.success(); } }
private Read txState( long... ids ) { return txState( LongStream.of( ids ).mapToObj( id -> rel( id, node, node, type ) ).toArray( Rel[]::new ) ); }
private StorageRelationshipTraversalCursor storeCursor( long... ids ) { return storeCursor( LongStream.of( ids ).mapToObj( id -> rel( id, -1L, -1L, -1 ) ).toArray( Rel[]::new ) ); }
private void updateOldNodes( LongStream idRange ) { try ( Transaction transaction = database.beginTx() ) { List<Node> nodes = idRange.mapToObj( id -> database.getNodeById( id ) ).collect( Collectors.toList() ); for ( int i = 0; i < NUMBER_OF_INDEXES; i++ ) { String propertyName = PROPERTY_PREFIX + i; nodes.forEach( node -> node.setProperty( propertyName, randomRule.nextLong() ) ); } transaction.success(); } }
public static RelationshipValue[] relationships( long... ids ) { return Arrays.stream( ids ) .mapToObj( id -> relationshipValue( id, node( 0L ), node( 1L ), stringValue( "T" ), emptyMap() ) ) .toArray( RelationshipValue[]::new ); } }
@BeforeClass public static void setUp() throws Exception { Configuration conf = UTIL.getConfiguration(); conf.setStrings(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY, AggregateImplementation.class.getName()); UTIL.startMiniCluster(3); byte[][] splitKeys = new byte[8][]; for (int i = 111; i < 999; i += 111) { splitKeys[i / 111 - 1] = Bytes.toBytes(String.format("%03d", i)); } UTIL.createTable(TABLE_NAME, CF, splitKeys); CONN = ConnectionFactory.createAsyncConnection(UTIL.getConfiguration()).get(); TABLE = CONN.getTable(TABLE_NAME); TABLE.putAll(LongStream.range(0, COUNT) .mapToObj(l -> new Put(Bytes.toBytes(String.format("%03d", l))) .addColumn(CF, CQ, Bytes.toBytes(l)).addColumn(CF, CQ2, Bytes.toBytes(l * l))) .collect(Collectors.toList())).get(); }
"SELECT * FROM " + partitionsTable, "VALUES " + LongStream.range(0, 1200) .mapToObj(String::valueOf) .collect(joining(",")));
createRLEBlock(1, 2000), 0.01, Floats.toArray(LongStream.range(-1000, 1000).mapToObj(Float::new).collect(toImmutableList())));