本文整理汇总了Java中org.jooq.lambda.tuple.Tuple3类的典型用法代码示例。如果您正苦于以下问题:Java Tuple3类的具体用法?Java Tuple3怎么用?Java Tuple3使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Tuple3类属于org.jooq.lambda.tuple包,在下文中一共展示了Tuple3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fixtures
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
@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)
);
}
示例2: readAll
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
@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);
});
}
示例3: buildChangeInitiativeRecord
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
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;
}
示例4: testCsvParser
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
@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());
}
示例5: window
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
/**
* 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);
}
示例6: testFunction5to3
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
@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);
}
示例7: testConsumer5to3
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
@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);
}
示例8: getBlockState
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
@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;
}
示例9: load
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
/**
* 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);
}
示例10: read
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
@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);
});
}
示例11: read
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
@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);
});
}
示例12: read
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
@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);
});
}
示例13: mkNameSelect
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
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));
}
示例14: testMetaDataOnJoolTuple
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
@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());
}
示例15: collect
import org.jooq.lambda.tuple.Tuple3; //导入依赖的package包/类
/**
* 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));
}