Java 类org.jooq.lambda.tuple.Tuple3 实例源码

项目:json2java4idea    文件:ValueTypeTest.java   
@Parameters(name = "{0}")
public static Collection<Tuple3<ValueType, Object, Class>> fixtures() {
    return Arrays.asList(
            Tuple.tuple(ValueType.NULL, null, JsonNull.class),
            Tuple.tuple(ValueType.BOOLEAN, true, JsonBoolean.class),
            Tuple.tuple(ValueType.INT, 42, JsonNumber.class),
            Tuple.tuple(ValueType.LONG, 42L, JsonNumber.class),
            Tuple.tuple(ValueType.FLOAT, 4.2f, JsonNumber.class),
            Tuple.tuple(ValueType.DOUBLE, 4.2d, JsonNumber.class),
            Tuple.tuple(ValueType.BIG_INTEGER, BigInteger.ONE, JsonNumber.class),
            Tuple.tuple(ValueType.BIG_DECIMAL, BigDecimal.ONE, JsonNumber.class),
            Tuple.tuple(ValueType.STRING, "foo", JsonString.class),
            Tuple.tuple(ValueType.ARRAY, Collections.emptyList(), JsonArray.class),
            Tuple.tuple(ValueType.OBJECT, Collections.emptyMap(), JsonObject.class)
    );
}
项目:json2java4idea    文件:ValueTypeTest.java   
@Parameters(name = "{0}")
public static Collection<Tuple3<ValueType, Object, String>> fixtures() {
    return Arrays.asList(
            Tuple.tuple(ValueType.NULL, "null", "Value 'null' is not a null"),
            Tuple.tuple(ValueType.BOOLEAN, null, "Value 'null' is not a boolean"),
            Tuple.tuple(ValueType.INT, null, "Value 'null' is not an int"),
            Tuple.tuple(ValueType.LONG, null, "Value 'null' is not a long"),
            Tuple.tuple(ValueType.FLOAT, null, "Value 'null' is not a float"),
            Tuple.tuple(ValueType.DOUBLE, null, "Value 'null' is not a double"),
            Tuple.tuple(ValueType.BIG_INTEGER, null, "Value 'null' is not a big integer"),
            Tuple.tuple(ValueType.BIG_DECIMAL, null, "Value 'null' is not a big decimal"),
            Tuple.tuple(ValueType.STRING, null, "Value 'null' is not a string"),
            Tuple.tuple(ValueType.ARRAY, null, "Value 'null' is not an array"),
            Tuple.tuple(ValueType.OBJECT, null, "Value 'null' is not an object")
    );
}
项目:RankSys    文件:TuplesRecommendationFormat.java   
@Override
public Stream<Recommendation<U, I>> readAll() {
    BufferedReader reader = new BufferedReader(new InputStreamReader(in), 128 * 1024);

    return groupAdjacent(reader.lines().map(tupleReader), (t1, t2) -> t1.v1.equals(t2.v1))
            .map(userTuples -> {
                U user = userTuples.get(0).v1;

                List<Tuple2od<I>> items = userTuples.stream()
                        .map(Tuple3::skip1)
                        .map(Tuple2od::new)
                        .collect(toList());

                if (sortByDecreasingScore) {
                    items.sort(Comparator.comparingDouble((Tuple2od<I> r) -> r.v2)
                            .reversed());
                }

                return new Recommendation<>(user, items);
            });
}
项目:waltz    文件:ChangeInitiativeGenerator.java   
private static ChangeInitiativeRecord buildChangeInitiativeRecord(Tuple3<Long, String, Long> t) {
    Date.from(Instant.now());
    ChangeInitiativeRecord record = new ChangeInitiativeRecord();
    record.setDescription(t.v2);
    record.setName(t.v2);
    record.setProvenance("dummy");
    record.setExternalId("EXT" + t.v1);
    record.setKind("PROGRAMME");
    record.setLifecyclePhase(randomPick(LifecyclePhase.values()).name());
    record.setId(t.v1);
    record.setStartDate(new Date(Instant.now().toEpochMilli()));
    record.setOrganisationalUnitId(t.v3);
    record.setEndDate(new Date(
            Instant.now()
                .plusSeconds(rnd.nextInt(60 * 60 * 24 * 365 * 2))
                .toEpochMilli()));
    return record;

}
项目:SimpleFlatMapper    文件:JoolTupleTest.java   
@Test
public void testCsvParser() throws IOException {
    final CsvParser.StaticMapToDSL<Tuple3<Long, Integer, Short>> mapToDSL = CsvParser.mapTo(new TypeReference<Tuple3<Long, Integer, Short>>() {
    }).defaultHeaders();
    final Iterator<Tuple3<Long, Integer, Short>> iterator = mapToDSL.iterator(new StringReader("6,7,3\n7,8,9"));

    final Tuple3<Long, Integer, Short> tuple1 = iterator.next();

    assertEquals(6l, tuple1.v1().longValue());
    assertEquals(7, tuple1.v2().intValue());
    assertEquals((short)3, tuple1.v3().shortValue());

    final Tuple3<Long, Integer, Short> tuple2 = iterator.next();

    assertEquals(7l, tuple2.v1().longValue());
    assertEquals(8, tuple2.v2().intValue());
    assertEquals((short)9, tuple2.v3().shortValue());
}
项目:jOOL    文件:Seq.java   
/**
 * Map this stream to a windowed stream with 3 distinct windows.
 */
@Generated("This method was generated using jOOQ-tools")
default Seq<Tuple3<Window<T>, Window<T>, Window<T>>> window(
    WindowSpecification<T> specification1,
    WindowSpecification<T> specification2,
    WindowSpecification<T> specification3
) {
    List<Tuple2<T, Long>> buffer = zipWithIndex().toList();

    Map<?, Partition<T>> partitions1 = SeqUtils.partitions(specification1, buffer);
    Map<?, Partition<T>> partitions2 = SeqUtils.partitions(specification2, buffer);
    Map<?, Partition<T>> partitions3 = SeqUtils.partitions(specification3, buffer);

    return seq(buffer)
          .map(t -> tuple(
               (Window<T>) new WindowImpl<>(t, partitions1.get(specification1.partition().apply(t.v1)), specification1),
               (Window<T>) new WindowImpl<>(t, partitions2.get(specification2.partition().apply(t.v1)), specification2),
               (Window<T>) new WindowImpl<>(t, partitions3.get(specification3.partition().apply(t.v1)), specification3)
          ))
          .onClose(this::close);
}
项目:jOOL    文件:PartialApplicationTest.java   
@Test
public void testFunction5to3() {
    Tuple2<Integer, Integer> t1 = tuple(4, 4);
    Tuple3<Integer, Integer, Integer> t2 = tuple(5, 3, 2);

    // Concat the two and three tuples and apply them together.
    int normal1 = lift(this::fiveArgMethod).apply(t1.concat(t2));

    // Apply partially the first two values, then apply the remaining three
    int partiallyAppliedExplicitExplicit = lift(this::fiveArgMethod).applyPartially(t1.v1, t1.v2).apply(t2.v1, t2.v2, t2.v3);
    int partiallyAppliedExplicitTuple = lift(this::fiveArgMethod).applyPartially(t1.v1, t1.v2).apply(t2);
    int partiallyAppliedTupleExplicit = lift(this::fiveArgMethod).applyPartially(t1).apply(t2.v1, t2.v2, t2.v3);
    int partiallyAppliedTupleTuple = lift(this::fiveArgMethod).applyPartially(t1).apply(t2);

    assertEquals(normal1, partiallyAppliedExplicitExplicit);
    assertEquals(normal1, partiallyAppliedExplicitTuple);
    assertEquals(normal1, partiallyAppliedTupleExplicit);
    assertEquals(normal1, partiallyAppliedTupleTuple);
}
项目:jOOL    文件:PartialApplicationTest.java   
@Test
public void testConsumer5to3() {
    Tuple2<Integer, Integer> t1 = tuple(4, 4);
    Tuple3<Integer, Integer, Integer> t2 = tuple(5, 3, 2);

    // Concat the two and three tuples and apply them together.
    lift(this::fiveArgConsumer).accept(t1.concat(t2));
    int normal1 = result;

    // Accept partially the first two values, then accept the remaining three
    lift(this::fiveArgConsumer).acceptPartially(t1.v1, t1.v2).accept(t2.v1, t2.v2, t2.v3);
    int partiallyAppliedExplicitExplicit = result;
    lift(this::fiveArgConsumer).acceptPartially(t1.v1, t1.v2).accept(t2);
    int partiallyAppliedExplicitTuple = result;
    lift(this::fiveArgConsumer).acceptPartially(t1).accept(t2.v1, t2.v2, t2.v3);
    int partiallyAppliedTupleExplicit = result;
    lift(this::fiveArgConsumer).acceptPartially(t1).accept(t2);
    int partiallyAppliedTupleTuple = result;

    assertEquals(normal1, partiallyAppliedExplicitExplicit);
    assertEquals(normal1, partiallyAppliedExplicitTuple);
    assertEquals(normal1, partiallyAppliedTupleExplicit);
    assertEquals(normal1, partiallyAppliedTupleTuple);
}
项目:json2java4idea    文件:ValueTypeTest.java   
@Parameters(name = "{0}")
public static Collection<Tuple3<ValueType, Object, Boolean>> fixtures() {
    return Arrays.asList(
            Tuple.tuple(ValueType.NULL, null, true),
            Tuple.tuple(ValueType.NULL, "null", false),
            Tuple.tuple(ValueType.BOOLEAN, true, true),
            Tuple.tuple(ValueType.BOOLEAN, "true", false),
            Tuple.tuple(ValueType.INT, 1024, true),
            Tuple.tuple(ValueType.INT, 1024L, false),
            Tuple.tuple(ValueType.LONG, 1024L, true),
            Tuple.tuple(ValueType.LONG, 1024, false),
            Tuple.tuple(ValueType.FLOAT, 1.0f, true),
            Tuple.tuple(ValueType.FLOAT, 1.0d, false),
            Tuple.tuple(ValueType.DOUBLE, 1.0d, true),
            Tuple.tuple(ValueType.DOUBLE, 1.0f, false),
            Tuple.tuple(ValueType.BIG_INTEGER, BigInteger.ONE, true),
            Tuple.tuple(ValueType.BIG_INTEGER, 1, false),
            Tuple.tuple(ValueType.BIG_DECIMAL, BigDecimal.ONE, true),
            Tuple.tuple(ValueType.BIG_DECIMAL, 1, false),
            Tuple.tuple(ValueType.STRING, "text", true),
            Tuple.tuple(ValueType.STRING, null, false),
            Tuple.tuple(ValueType.ARRAY, Collections.singletonList("test"), true),
            Tuple.tuple(ValueType.ARRAY, null, false),
            Tuple.tuple(ValueType.OBJECT, Collections.singletonMap("key", "test"), true),
            Tuple.tuple(ValueType.OBJECT, null, false)
    );
}
项目:Alchemy    文件:SkinCapability.java   
@Hook("net.minecraft.world.World#func_180495_p")
public static Hook.Result getBlockState(World world, BlockPos pos) {
    Tuple3<IBlockAccess, BlockPos, IBlockState> tuple3 = cache.get();
    if (tuple3 != null && tuple3.v1() == world && pos.equals(tuple3.v2()))
        return new Hook.Result(tuple3.v3());
    return Hook.Result.VOID;
}
项目:RankSys    文件:SimpleFeatureData.java   
/**
 * Loads an instance of the class from a stream of triples.
 *
 * @param <I> type of item
 * @param <F> type of feat
 * @param <V> type of value
 * @param tuples stream of item-feat-value triples
 * @return a feature data object
 */
public static <I, F, V> SimpleFeatureData<I, F, V> load(Stream<Tuple3<I, F, V>> tuples) {
    Map<I, List<Tuple2<F, V>>> itemMap = new HashMap<>();
    Map<F, List<Tuple2<I, V>>> featMap = new HashMap<>();

    tuples.forEach(t -> {
        itemMap.computeIfAbsent(t.v1, v1 -> new ArrayList<>()).add(tuple(t.v2, t.v3));
        featMap.computeIfAbsent(t.v2, v2 -> new ArrayList<>()).add(tuple(t.v1, t.v3));
    });

    return new SimpleFeatureData<>(itemMap, featMap);
}
项目:RankSys    文件:SimpleFeaturesReader.java   
@Override
public <I, F> Stream<Tuple3<I, F, Double>> read(InputStream in, Parser<I> ip, Parser<F> fp) {
    return new BufferedReader(new InputStreamReader(in)).lines().map(line -> {
        String[] tokens = line.split("\t", 3);
        I item = ip.parse(tokens[0]);
        F feat = fp.parse(tokens[1]);

        return Tuple.tuple(item, feat, 1.0);
    });
}
项目:RankSys    文件:SimpleRatingPreferencesReader.java   
@Override
public <U, I> Stream<Tuple3<U, I, Double>> read(InputStream in, Parser<U> up, Parser<I> ip) {
    return new BufferedReader(new InputStreamReader(in)).lines().map(line -> {
        CharSequence[] tokens = split(line, '\t', 4);
        U user = up.parse(tokens[0]);
        I item = ip.parse(tokens[1]);
        double value = parseDouble(tokens[2].toString());

        return Tuple.tuple(user, item, value);
    });
}
项目:RankSys    文件:SimpleBinaryPreferencesReader.java   
@Override
public <U, I> Stream<Tuple3<U, I, Double>> read(InputStream in, Parser<U> up, Parser<I> ip) {
    return new BufferedReader(new InputStreamReader(in)).lines().map(line -> {
        CharSequence[] tokens = split(line, '\t', 3);
        U user = up.parse(tokens[0]);
        I item = ip.parse(tokens[1]);

        return Tuple.tuple(user, item, 1.0);
    });
}
项目:waltz    文件:EntityNameUtilities.java   
private static Select<Record1<String>> mkNameSelect(Tuple3<Table, Field<Long>, Field<String>> mapping,
                                                    Field<Long> idCompareField) {
    // form the query to fetch entity names
    //
    // v1: entity table
    // v3: name field in the entity table
    // v2: id field in the entity table
    //
    // eg: select name from application where id = entity_statistic_value.entity_id
    //
    return DSL.select(mapping.v3())
            .from(mapping.v1())
            .where(mapping.v2().eq(idCompareField));
}
项目:SimpleFlatMapper    文件:JoolTupleTest.java   
@Test
public void testMetaDataOnJoolTuple() throws Exception {


    //creates a new tuple allocated on the JVM heap

    System.out.println("super " + Tuple3.class.toString());
    for(Class<?> clazz : Tuple3.class.getInterfaces()) {
        System.out.println("I " + clazz.toString());

    }

    ClassMeta<Tuple3<Long, Integer, Short>> cm =
            ReflectionService.newInstance().getClassMeta(new TypeReference<Tuple3<Long, Integer, Short>>(){}.getType());

    final PropertyFinder<Tuple3<Long, Integer, Short>> propertyFinder = cm.newPropertyFinder(isValidPropertyMeta);

    final PropertyMeta<Tuple3<Long, Integer, Short>, Long> fieldA = propertyFinder.findProperty(new DefaultPropertyNameMatcher("elt0", 0, true, true), new Object[0]);
    final PropertyMeta<Tuple3<Long, Integer, Short>, Integer> fieldB = propertyFinder.findProperty(new DefaultPropertyNameMatcher("elt1", 0, true, true), new Object[0]);
    final PropertyMeta<Tuple3<Long, Integer, Short>, Short> fieldC = propertyFinder.findProperty(new DefaultPropertyNameMatcher("elt2", 0, true, true), new Object[0]);
    final PropertyMeta<Tuple3<Long, Integer, Short>, ?> fieldD = propertyFinder.findProperty(new DefaultPropertyNameMatcher("elt3", 0, true, true), new Object[0]);

    assertNotNull(fieldA);
    assertNotNull(fieldB);
    assertNotNull(fieldC);
    assertNull(fieldD);

    Tuple3<Long, Integer, Short> tuple = new Tuple3<Long, Integer, Short>(6l, 7, (short)3);

    assertTrue(fieldA instanceof ConstructorPropertyMeta);
    assertTrue(fieldB instanceof ConstructorPropertyMeta);
    assertTrue(fieldC instanceof ConstructorPropertyMeta);

    Assert.assertEquals(6l, fieldA.getGetter().get(tuple).longValue());
    Assert.assertEquals(7, fieldB.getGetter().get(tuple).intValue());
    Assert.assertEquals(3, fieldC.getGetter().get(tuple).shortValue());

}
项目:jOOL    文件:Collectable.java   
/**
 * Collect this collectable into 3 {@link Collector}s.
 */
@Generated("This method was generated using jOOQ-tools")
default <R1, R2, R3, A1, A2, A3> Tuple3<R1, R2, R3> collect(
    Collector<? super T, A1, R1> collector1,
    Collector<? super T, A2, R2> collector2,
    Collector<? super T, A3, R3> collector3
) {
    return collect(Tuple.collectors(collector1, collector2, collector3));
}
项目:jOOL    文件:Seq.java   
/**
 * Cross join 3 streams into one.
 * <p>
 * <code><pre>
 * // (tuple(1, "a"), tuple(1, "b"), tuple(2, "a"), tuple(2, "b"))
 * Seq.of(1, 2).crossJoin(Seq.of("a", "b"))
 * </pre></code>
 */
@Generated("This method was generated using jOOQ-tools")
static <T1, T2, T3> Seq<Tuple3<T1, T2, T3>> crossJoin(Seq<? extends T1> s1, Seq<? extends T2> s2, Seq<? extends T3> s3) {

    // [#323] Some explicit type variable bindings required because of compiler regressions in JDK 9
    List<Tuple2<T2, T3>> list = Seq.<T2, T3>crossJoin(s2, s3).toList();
    return s1.flatMap(v1 -> seq(list).map(t -> tuple(v1, t.v1, t.v2)))
             .onClose(SeqUtils.closeAll(s2, s3));
}
项目:jOOL    文件:Seq.java   
/**
 * Cross join 4 streams into one.
 * <p>
 * <code><pre>
 * // (tuple(1, "a"), tuple(1, "b"), tuple(2, "a"), tuple(2, "b"))
 * Seq.of(1, 2).crossJoin(Seq.of("a", "b"))
 * </pre></code>
 */
@Generated("This method was generated using jOOQ-tools")
static <T1, T2, T3, T4> Seq<Tuple4<T1, T2, T3, T4>> crossJoin(Seq<? extends T1> s1, Seq<? extends T2> s2, Seq<? extends T3> s3, Seq<? extends T4> s4) {

    // [#323] Some explicit type variable bindings required because of compiler regressions in JDK 9
    List<Tuple3<T2, T3, T4>> list = Seq.<T2, T3, T4>crossJoin(s2, s3, s4).toList();
    return s1.flatMap(v1 -> seq(list).map(t -> tuple(v1, t.v1, t.v2, t.v3)))
             .onClose(SeqUtils.closeAll(s2, s3, s4));
}
项目:jOOL    文件:SeqTest.java   
@Test
public void testRunningTotal() {

    // Do the calculation from this blog post in Java
    // http://blog.jooq.org/2014/04/29/nosql-no-sql-how-to-calculate-running-totals/

    // | ID   | VALUE_DATE | AMOUNT |  BALANCE |
    // |------|------------|--------|----------|
    // | 9997 | 2014-03-18 |  99.17 | 19985.81 |
    // | 9981 | 2014-03-16 |  71.44 | 19886.64 |
    // | 9979 | 2014-03-16 | -94.60 | 19815.20 |
    // | 9977 | 2014-03-16 |  -6.96 | 19909.80 |
    // | 9971 | 2014-03-15 | -65.95 | 19916.76 |

    BigDecimal currentBalance = new BigDecimal("19985.81");

    assertEquals(
        asList(
            new BigDecimal("19985.81"),
            new BigDecimal("19886.64"),
            new BigDecimal("19815.20"),
            new BigDecimal("19909.80"),
            new BigDecimal("19916.76")
        ),
        Seq.of(
                tuple(9997, "2014-03-18", new BigDecimal("99.17")),
                tuple(9981, "2014-03-16", new BigDecimal("71.44")),
                tuple(9979, "2014-03-16", new BigDecimal("-94.60")),
                tuple(9977, "2014-03-16", new BigDecimal("-6.96")),
                tuple(9971, "2014-03-15", new BigDecimal("-65.95")))
           .window(Comparator.comparing((Tuple3<Integer, String, BigDecimal> t) -> t.v1, reverseOrder()).thenComparing(t -> t.v2), Long.MIN_VALUE, -1)
           .map(w -> w.value().concat(
                currentBalance.subtract(w.sum(t -> t.v3).orElse(BigDecimal.ZERO))
           ))
           .map(t -> t.v4)
           .toList()
    );
}
项目:rival    文件:PreferenceDataWrapper.java   
public PreferenceDataWrapper(TemporalDataModelIF<Long, Long> data, FastUserIndex<Long> uIndex, FastItemIndex<Long> iIndex) {
    List<Tuple3<Long, Long, Double>> tuples = new ArrayList<>();
    for (Long u : data.getUsers()) {
        for (Long i : data.getUserItems(u)) {
            tuples.add(new Tuple3<>(u, i, data.getUserItemPreference(u, i)));
        }
    }
    wrapper = SimpleFastPreferenceData.load(tuples.stream(), uIndex, iIndex);
}
项目:json2java4idea    文件:DefaultNamePolicyTest.java   
@Parameters(name = "{0}")
public static Collection<Tuple3<String, CaseFormat, String>> fixtures() {
    return Arrays.asList(
            Tuple.tuple(
                    "this is a lower space case",
                    CaseFormat.LOWER_HYPHEN,
                    "this-is-a-lower-space-case"
            ),
            Tuple.tuple(
                    "THIS IS A UPPER SPACE CASE",
                    CaseFormat.LOWER_HYPHEN,
                    "this-is-a-upper-space-case"
            ),
            Tuple.tuple(
                    "this_is_a_lower_snake_case",
                    CaseFormat.LOWER_HYPHEN,
                    "this-is-a-lower-snake-case"
            ),
            Tuple.tuple(
                    "THIS_IS_A_UPPER_SNAKE_CASE",
                    CaseFormat.LOWER_HYPHEN,
                    "this-is-a-upper-snake-case"
            ),
            Tuple.tuple(
                    "this-is-a-lower-kebab-case",
                    CaseFormat.LOWER_HYPHEN,
                    "this-is-a-lower-kebab-case"
            ),
            Tuple.tuple(
                    "THIS-IS-A-UPPER-KEBAB-CASE",
                    CaseFormat.LOWER_HYPHEN,
                    "this-is-a-upper-kebab-case"
            ),
            Tuple.tuple(
                    "thisIsALowerCamelCase",
                    CaseFormat.LOWER_HYPHEN,
                    "this-is-a-lower-camel-case"
            ),
            Tuple.tuple(
                    "ThisIsAUpperCamelCase",
                    CaseFormat.LOWER_HYPHEN,
                    "this-is-a-upper-camel-case"
            ),
            Tuple.tuple(
                    "THIS is-A mix-leTTer_CASe",
                    CaseFormat.LOWER_HYPHEN,
                    "this-is-a-mix-letter-case"
            ),
            Tuple.tuple(
                    "THIS.iS_A RaND0m Letter$ -case_!",
                    CaseFormat.LOWER_HYPHEN,
                    "this-is-a-rand0m-letter$-case"
            ),
            Tuple.tuple(
                    "これはラテン文字ではありません。",
                    CaseFormat.LOWER_HYPHEN,
                    ""
            )
    );
}
项目:json2java4idea    文件:DefaultNamePolicyTest.java   
public FormatTest(@Nonnull Tuple3<String, CaseFormat, String> fixture) {
    name = fixture.v1();
    format = fixture.v2();
    expected = fixture.v3();
}
项目:json2java4idea    文件:ValueTypeTest.java   
public IsAcceptableTest(@Nonnull Tuple3<ValueType, Object, Boolean> fixture) {
    underTest = fixture.v1();
    value = fixture.v2();
    expected = fixture.v3();
}
项目:json2java4idea    文件:ValueTypeTest.java   
public NormalWrapTest(@Nonnull Tuple3<ValueType, Object, Class> fixture) {
    this.underTest = fixture.v1();
    this.value = fixture.v2();
    this.expected = fixture.v3();
}
项目:json2java4idea    文件:ValueTypeTest.java   
public NonNormalWrapTest(@Nonnull Tuple3<ValueType, Object, String> fixture) {
    underTest = fixture.v1();
    value = fixture.v2();
    expected = fixture.v3();
}
项目:georocket    文件:IndexerVerticle.java   
/**
 * Insert multiple Elasticsearch documents into the index. Perform a
 * bulk request. This method replies to all messages if the bulk request
 * was successful.
 * @param type Elasticsearch type for documents
 * @param documents a list of tuples containing document IDs, documents to
 * index, and the respective messages from which the documents were created
 * @return an observable that completes when the operation has finished
 */
private Observable<Void> insertDocuments(String type,
    List<Tuple3<String, JsonObject, Message<JsonObject>>> documents) {
  long startTimeStamp = System.currentTimeMillis();

  List<String> chunkPaths = Seq.seq(documents)
    .map(Tuple3::v1)
    .toList();
  onIndexingStarted(startTimeStamp, chunkPaths);

  List<Tuple2<String, JsonObject>> docsToInsert = Seq.seq(documents)
    .map(Tuple3::limit2)
    .toList();
  List<Message<JsonObject>> messages = Seq.seq(documents)
    .map(Tuple3::v3)
    .toList();

  return client.bulkInsert(type, docsToInsert).flatMap(bres -> {
    JsonArray items = bres.getJsonArray("items");
    for (int i = 0; i < items.size(); ++i) {
      JsonObject jo = items.getJsonObject(i);
      JsonObject item = jo.getJsonObject("index");
      Message<JsonObject> msg = messages.get(i);
      if (client.bulkResponseItemHasErrors(item)) {
        msg.fail(500, client.bulkResponseItemGetErrorMessage(item));
      } else {
        msg.reply(null);
      }
    }

    long stopTimeStamp = System.currentTimeMillis();
    List<String> correlationIds = Seq.seq(messages)
      .map(Message::body)
      .map(d -> d.getString("correlationId"))
      .toList();
    onIndexingFinished(stopTimeStamp - startTimeStamp, correlationIds,
        chunkPaths, client.bulkResponseGetErrorMessage(bres));

    return Observable.empty();
  });
}
项目:RankSys    文件:SimpleFeaturesReader.java   
@Override
public <I, F> Stream<Tuple3<I, F, Double>> read(String in, Parser<I> ip, Parser<F> fp) throws IOException {
    return read(new FileInputStream(in), ip, fp);
}
项目:jOOL    文件:Function14.java   
/**
 * Partially apply this function to the arguments.
 */
default Function11<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, R> applyPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return (v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) -> apply(args.v1, args.v2, args.v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14);
}
项目:jOOL    文件:Consumer6.java   
/**
 * Let this consumer partially accept the arguments.
 */
default Consumer3<T4, T5, T6> acceptPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return (v4, v5, v6) -> accept(args.v1, args.v2, args.v3, v4, v5, v6);
}
项目:jOOL    文件:Consumer7.java   
/**
 * Let this consumer partially accept the arguments.
 */
default Consumer4<T4, T5, T6, T7> acceptPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return (v4, v5, v6, v7) -> accept(args.v1, args.v2, args.v3, v4, v5, v6, v7);
}
项目:jOOL    文件:Function9.java   
/**
 * Partially apply this function to the arguments.
 */
default Function6<T4, T5, T6, T7, T8, T9, R> applyPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return (v4, v5, v6, v7, v8, v9) -> apply(args.v1, args.v2, args.v3, v4, v5, v6, v7, v8, v9);
}
项目:jOOL    文件:Function4.java   
/**
 * Partially apply this function to the arguments.
 */
default Function1<T4, R> applyPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return (v4) -> apply(args.v1, args.v2, args.v3, v4);
}
项目:jOOL    文件:Consumer16.java   
/**
 * Let this consumer partially accept the arguments.
 */
default Consumer13<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> acceptPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return (v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) -> accept(args.v1, args.v2, args.v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16);
}
项目:jOOL    文件:Function10.java   
/**
 * Partially apply this function to the arguments.
 */
default Function7<T4, T5, T6, T7, T8, T9, T10, R> applyPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return (v4, v5, v6, v7, v8, v9, v10) -> apply(args.v1, args.v2, args.v3, v4, v5, v6, v7, v8, v9, v10);
}
项目:jOOL    文件:Function11.java   
/**
 * Partially apply this function to the arguments.
 */
default Function8<T4, T5, T6, T7, T8, T9, T10, T11, R> applyPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return (v4, v5, v6, v7, v8, v9, v10, v11) -> apply(args.v1, args.v2, args.v3, v4, v5, v6, v7, v8, v9, v10, v11);
}
项目:jOOL    文件:Function7.java   
/**
 * Partially apply this function to the arguments.
 */
default Function4<T4, T5, T6, T7, R> applyPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return (v4, v5, v6, v7) -> apply(args.v1, args.v2, args.v3, v4, v5, v6, v7);
}
项目:jOOL    文件:Function3.java   
/**
 * Partially apply this function to the arguments.
 */
default Function0<R> applyPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return () -> apply(args.v1, args.v2, args.v3);
}
项目:jOOL    文件:Function16.java   
/**
 * Partially apply this function to the arguments.
 */
default Function13<T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, R> applyPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return (v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) -> apply(args.v1, args.v2, args.v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16);
}
项目:jOOL    文件:Consumer3.java   
/**
 * Let this consumer partially accept the arguments.
 */
default Consumer0 acceptPartially(Tuple3<? extends T1, ? extends T2, ? extends T3> args) {
    return () -> accept(args.v1, args.v2, args.v3);
}