New package for functional types, renaming away from Quad- prefix
Project: http://git-wip-us.apache.org/repos/asf/jena/repo Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/e633f334 Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/e633f334 Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/e633f334 Branch: refs/heads/master Commit: e633f33409f49e4a54f90dd565985bcfeeb52dbd Parents: 37b7bff Author: ajs6f <[email protected]> Authored: Sun Jan 17 15:39:54 2016 -0500 Committer: ajs6f <[email protected]> Committed: Sun Jan 17 15:40:27 2016 -0500 ---------------------------------------------------------------------- .../jena/sparql/core/mem/OrderedTupleTable.java | 8 +- .../jena/sparql/core/mem/PMapQuadTable.java | 6 +- .../sparql/core/mem/SimpleMapQuadTable.java | 97 ++++++++++++++++++++ .../sparql/core/mem/SimpleMapTripleTable.java | 78 ++++++++++++++++ .../sparql/core/mem/SimpleMapTupleTable.java | 43 +++++++++ .../jena/atlas/function/TetraConsumer.java | 39 ++++++++ .../jena/atlas/function/TetraFunction.java | 41 +++++++++ .../jena/atlas/function/package-info.java | 22 +++++ .../apache/jena/atlas/lib/tuple/Consumer4.java | 11 +++ .../jena/atlas/lib/tuple/QuadConsumer.java | 47 ---------- .../jena/atlas/lib/tuple/QuadFunction.java | 50 ---------- .../jena/atlas/lib/tuple/TetraOperator.java | 12 +++ 12 files changed, 350 insertions(+), 104 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/OrderedTupleTable.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/OrderedTupleTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/OrderedTupleTable.java index 822333a..5490b15 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/OrderedTupleTable.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/OrderedTupleTable.java @@ -20,9 +20,9 @@ package org.apache.jena.sparql.core.mem; import java.util.function.Consumer; +import org.apache.jena.atlas.lib.tuple.Consumer4; +import org.apache.jena.atlas.lib.tuple.TetraOperator; import org.apache.jena.atlas.lib.tuple.TupleMap; -import org.apache.jena.atlas.lib.tuple.QuadConsumer.Consumer4; -import org.apache.jena.atlas.lib.tuple.QuadFunction.QuadOperator; import org.apache.jena.atlas.lib.tuple.TriConsumer.Consumer3; import org.apache.jena.atlas.lib.tuple.TriFunction.TriOperator; import org.apache.jena.graph.Node; @@ -80,7 +80,7 @@ public abstract class OrderedTupleTable<TupleType, ConsumerType> implements Tupl }; } - protected <X> QuadOperator<Node, X> map(final QuadOperator<Node, X> f) { + protected <X> TetraOperator<Node, X> map(final TetraOperator<Node, X> f) { return (g, s, p, o) -> apply(order, g, s, p, o, f); } @@ -128,7 +128,7 @@ public abstract class OrderedTupleTable<TupleType, ConsumerType> implements Tupl } private static <X, Z> Z apply(final TupleMap tupleMap, final X x1, final X x2, final X x3, final X x4, - final QuadOperator<X, Z> f) { + final TetraOperator<X, Z> f) { final X x1a = get(tupleMap.mapIdx(0), x1, x2, x3, x4); final X x2a = get(tupleMap.mapIdx(1), x1, x2, x3, x4); final X x3a = get(tupleMap.mapIdx(2), x1, x2, x3, x4); http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java index 47a6eed..6c1e45c 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/PMapQuadTable.java @@ -25,8 +25,8 @@ import java.util.stream.Stream; import org.apache.jena.atlas.lib.persistent.PMap; import org.apache.jena.atlas.lib.persistent.PersistentSet; -import org.apache.jena.atlas.lib.tuple.QuadConsumer.Consumer4; -import org.apache.jena.atlas.lib.tuple.QuadFunction.QuadOperator; +import org.apache.jena.atlas.lib.tuple.Consumer4; +import org.apache.jena.atlas.lib.tuple.TetraOperator; import org.apache.jena.atlas.lib.tuple.TupleMap; import org.apache.jena.graph.Node; import org.apache.jena.sparql.core.Quad; @@ -103,7 +103,7 @@ public class PMapQuadTable extends PMapTupleTable<FourTupleMap, Quad, Consumer4< * @return a <code>Stream</code> of tuples matching the pattern */ @SuppressWarnings("unchecked") // Because of (Stream<Quad>) -- but why is that needed? - private QuadOperator<Node, Stream<Quad>> find = (first, second, third, fourth) -> { + private TetraOperator<Node, Stream<Quad>> find = (first, second, third, fourth) -> { debug("Querying on four-tuple pattern: {} {} {} {} .", first, second, third, fourth); final FourTupleMap fourTuples = local().get(); if (isConcrete(first)) { http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapQuadTable.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapQuadTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapQuadTable.java new file mode 100644 index 0000000..eb00084 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapQuadTable.java @@ -0,0 +1,97 @@ +package org.apache.jena.sparql.core.mem; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; + +import org.apache.jena.atlas.lib.tuple.Consumer4; +import org.apache.jena.atlas.lib.tuple.TetraOperator; +import org.apache.jena.atlas.lib.tuple.TupleMap; +import org.apache.jena.graph.Node; +import org.apache.jena.sparql.core.Quad; + +public class SimpleMapQuadTable extends SimpleMapTupleTable<Map<Node, Map<Node, Set<Node>>>, Quad, Consumer4<Node>> + implements QuadTable { + + public SimpleMapQuadTable(final TupleMap order) { + super(order); + } + + + @Override + public void add(final Quad q) { + map(add()).accept(q); + } + + @Override + public void delete(final Quad q) { + map(delete()).accept(q); + } + + @Override + protected Consumer4<Node> add() { + return (first, second, third, fourth) -> { + table.getOrDefault(first, new HashMap<>()).getOrDefault(second, new HashMap<>()) + .getOrDefault(third, new HashSet<>()).add(fourth); + }; + } + + @Override + protected Consumer4<Node> delete() { + return (first, second, third, fourth) -> { + if (table.containsKey(first)) { + final Map<Node, Map<Node, Set<Node>>> threetuples = table.get(first); + if (threetuples.containsKey(second)) { + final Map<Node, Set<Node>> twotuples = threetuples.get(second); + if (twotuples.containsKey(third)) { + final Set<Node> fourths = twotuples.get(fourth); + if (fourths.remove(fourth) && fourths.isEmpty()) { + twotuples.remove(third); + if (twotuples.isEmpty()) { + threetuples.remove(second); + if (threetuples.isEmpty()) table.remove(first); + } + } + } + } + } + }; + } + + @Override + public Stream<Quad> find(Node g, Node s, Node p, Node o) { + return map(find).apply(g, s, p, o); + } + + private TetraOperator<Node, Stream<Quad>> find = (first, second, third, fourth) -> { + if (first != null && first.isConcrete()) { + // concrete value for first slot + final Map<Node, Map<Node, Set<Node>>> threetuples = table.get(first); + if (second != null && second.isConcrete()) { + // concrete value for second slot + final Map<Node, Set<Node>> twotuples = threetuples.get(second); + if (third != null && third.isConcrete()) { + // concrete value for third slot + if (fourth != null && fourth.isConcrete()) + // concrete value for fourth slot + return Stream.of(unmap(first, second, third, fourth)); + // wildcard for fourth slot + return twotuples.get(third).stream().map(slot4 -> unmap(first, second, third, slot4)); + } + // wildcard for third slot + return threetuples.get(second).entrySet().stream() + .flatMap(e -> e.getValue().stream().map(slot4 -> unmap(first, second, e.getKey(), slot4))); + } + // wildcard for second slot + return threetuples.entrySet().stream().flatMap(e -> e.getValue().entrySet().stream() + .flatMap(e1 -> e1.getValue().stream().map(slot4 -> unmap(first, e.getKey(), e1.getKey(), slot4)))); + } + // wildcard for first slot + return table.entrySet().stream() + .flatMap(e -> e.getValue().entrySet().stream() + .flatMap(e1 -> e1.getValue().entrySet().stream().flatMap(e2 -> e2.getValue().stream() + .map(slot4 -> unmap(e.getKey(), e1.getKey(), e2.getKey(), slot4))))); + }; +} http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapTripleTable.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapTripleTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapTripleTable.java new file mode 100644 index 0000000..bf63062 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapTripleTable.java @@ -0,0 +1,78 @@ +package org.apache.jena.sparql.core.mem; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.stream.Stream; + +import org.apache.jena.atlas.lib.tuple.TriConsumer.Consumer3; +import org.apache.jena.atlas.lib.tuple.TriFunction.TriOperator; +import org.apache.jena.atlas.lib.tuple.TupleMap; +import org.apache.jena.graph.Node; +import org.apache.jena.graph.Triple; + +public class SimpleMapTripleTable extends SimpleMapTupleTable<Map<Node, Set<Node>>, Triple, Consumer3<Node>> + implements TripleTable { + + public SimpleMapTripleTable(final TupleMap order) { + super(order); + } + + + @Override + public void add(final Triple t) { + map(add()).accept(t); + } + + @Override + public void delete(final Triple t) { + map(delete()).accept(t); + } + + protected Consumer3<Node> add() { + return (first, second, third) -> table.getOrDefault(first, new HashMap<>()) + .getOrDefault(second, new HashSet<>()).add(third); + } + + protected Consumer3<Node> delete() { + return (first, second, third) -> { + if (table.containsKey(first)) { + final Map<Node, Set<Node>> twotuples = table.get(first); + if (twotuples.containsKey(second)) { + final Set<Node> thirds = twotuples.get(second); + if (thirds.remove(third) && thirds.isEmpty()) { + twotuples.remove(second); + if (twotuples.isEmpty()) table.remove(first); + } + } + } + }; + } + + @Override + public Stream<Triple> find(final Node s, final Node p, final Node o) { + return map(find).apply(s, p, o); + } + + private TriOperator<Node, Stream<Triple>> find = (first, second, third) -> { + if (first != null && first.isConcrete()) { + // concrete value for first slot + final Map<Node, Set<Node>> twotuples = table.get(first); + if (second != null && second.isConcrete()) { + // concrete value for second slot + if (third != null && third.isConcrete()) + // concrete value for third slot + return Stream.of(unmap(first, second, third)); + // wildcard for third slot + return twotuples.get(second).stream().map(slot3 -> unmap(first, second, slot3)); + } + // wildcard for second slot + return twotuples.entrySet().stream() + .flatMap(e -> e.getValue().stream().map(slot3 -> unmap(first, e.getKey(), slot3))); + } + // wildcard for first slot + return table.entrySet().stream().flatMap(e -> e.getValue().entrySet().stream() + .flatMap(e1 -> e1.getValue().stream().map(slot3 -> unmap(e.getKey(), e1.getKey(), slot3)))); + }; +} http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapTupleTable.java ---------------------------------------------------------------------- diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapTupleTable.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapTupleTable.java new file mode 100644 index 0000000..36f84c5 --- /dev/null +++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/SimpleMapTupleTable.java @@ -0,0 +1,43 @@ +package org.apache.jena.sparql.core.mem; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.jena.atlas.lib.tuple.TupleMap; +import org.apache.jena.graph.Node; +import org.apache.jena.query.ReadWrite; + +public abstract class SimpleMapTupleTable<Tail, TupleType, ConsumerType> + extends OrderedTupleTable<TupleType, ConsumerType> implements TupleTable<TupleType> { + + protected final Map<Node, Tail> table = new HashMap<>(); + + public SimpleMapTupleTable(final TupleMap order) { + super(order); + } + + @Override + public void clear() { + table.clear(); + } + + @Override + public void begin(final ReadWrite readWrite) { + // NOOP + } + + @Override + public void commit() { + // NOOP + } + + @Override + public void abort() { + // NOOP + } + + @Override + public void end() { + // NOOP + } +} http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-base/src/main/java/org/apache/jena/atlas/function/TetraConsumer.java ---------------------------------------------------------------------- diff --git a/jena-base/src/main/java/org/apache/jena/atlas/function/TetraConsumer.java b/jena-base/src/main/java/org/apache/jena/atlas/function/TetraConsumer.java new file mode 100644 index 0000000..ce6355f --- /dev/null +++ b/jena-base/src/main/java/org/apache/jena/atlas/function/TetraConsumer.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jena.atlas.function; + +import java.util.function.Consumer; + +/** + * Represents an operation that accepts four input arguments and returns no result. This is a four-arity specialization + * of {@link Consumer}. Unlike most other functional interfaces, {@code QuadConsumer} is expected to operate via + * side-effects. + * <p> + * This is a functional interface whose functional method is {@link #accept}. + * + * @param <W> the type of the first argument to the operation + * @param <X> the type of the second argument to the operation + * @param <Y> the type of the third argument to the operation + * @param <Z> the type of the fourth argument to the operation + * @see Consumer + */ +@FunctionalInterface +public interface TetraConsumer<W, X, Y, Z> { + + void accept(final W w, final X x, final Y y, final Z z); +} http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-base/src/main/java/org/apache/jena/atlas/function/TetraFunction.java ---------------------------------------------------------------------- diff --git a/jena-base/src/main/java/org/apache/jena/atlas/function/TetraFunction.java b/jena-base/src/main/java/org/apache/jena/atlas/function/TetraFunction.java new file mode 100644 index 0000000..6d2ac1b --- /dev/null +++ b/jena-base/src/main/java/org/apache/jena/atlas/function/TetraFunction.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jena.atlas.function; + +import java.util.function.Function; + +/** + * Represents a function that accepts four arguments and produces a result. This is a four-arity specialization of + * {@link Function}. + * <p> + * This is a functional interface whose functional method is {@link #apply}. + * + * @param <W> the type of the first argument to the function + * @param <X> the type of the second argument to the function + * @param <Y> the type of the third argument to the function + * @param <Z> the type of the fourth argument to the function + * @param <R> the type of the result of the function + * @see Function + */ +@FunctionalInterface +public interface TetraFunction<W, X, Y, Z, R> { + + R apply(final W w, final X x, final Y y, final Z z); + +} http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-base/src/main/java/org/apache/jena/atlas/function/package-info.java ---------------------------------------------------------------------- diff --git a/jena-base/src/main/java/org/apache/jena/atlas/function/package-info.java b/jena-base/src/main/java/org/apache/jena/atlas/function/package-info.java new file mode 100644 index 0000000..e601fa4 --- /dev/null +++ b/jena-base/src/main/java/org/apache/jena/atlas/function/package-info.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Types for functional style. + */ +package org.apache.jena.atlas.function; \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/Consumer4.java ---------------------------------------------------------------------- diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/Consumer4.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/Consumer4.java new file mode 100644 index 0000000..361dcf4 --- /dev/null +++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/Consumer4.java @@ -0,0 +1,11 @@ +package org.apache.jena.atlas.lib.tuple; + +import org.apache.jena.atlas.function.TetraConsumer; + +/** + * A specialization of {@link TetraConsumer} in which all arguments are of the same type. + * + * @param <X> the type of all arguments + */ +@FunctionalInterface +public interface Consumer4<X> extends TetraConsumer<X, X, X, X> {} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/QuadConsumer.java ---------------------------------------------------------------------- diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/QuadConsumer.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/QuadConsumer.java deleted file mode 100644 index 0a3b7a3..0000000 --- a/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/QuadConsumer.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.jena.atlas.lib.tuple; - -import java.util.function.Consumer; - -/** - * Represents an operation that accepts four input arguments and returns no result. This is a four-arity specialization - * of {@link Consumer}. Unlike most other functional interfaces, {@code QuadConsumer} is expected to operate via - * side-effects. - * <p> - * This is a functional interface whose functional method is {@link #accept}. - * - * @param <W> the type of the first argument to the operation - * @param <X> the type of the second argument to the operation - * @param <Y> the type of the third argument to the operation - * @param <Z> the type of the fourth argument to the operation - * @see Consumer - */ -@FunctionalInterface -public interface QuadConsumer<W, X, Y, Z> { - - void accept(final W w, final X x, final Y y, final Z z); - - /** - * A specialization of {@link QuadConsumer} in which all arguments are of the same type. - * - * @param <X> the type of all arguments - */ - @FunctionalInterface - static interface Consumer4<X> extends QuadConsumer<X, X, X, X> {} -} http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/QuadFunction.java ---------------------------------------------------------------------- diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/QuadFunction.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/QuadFunction.java deleted file mode 100644 index 89653a3..0000000 --- a/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/QuadFunction.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jena.atlas.lib.tuple; - -import java.util.function.Function; - -/** - * Represents a function that accepts four arguments and produces a result. This is a four-arity specialization of - * {@link Function}. - * <p> - * This is a functional interface whose functional method is {@link #apply}. - * - * @param <W> the type of the first argument to the function - * @param <X> the type of the second argument to the function - * @param <Y> the type of the third argument to the function - * @param <Z> the type of the fourth argument to the function - * @param <R> the type of the result of the function - * @see Function - */ -@FunctionalInterface -public interface QuadFunction<W, X, Y, Z, R> { - - R apply(final W w, final X x, final Y y, final Z z); - - /** - * A specialization of {@link QuadFunction} in which all arguments are of the same type. - * - * @param <X> the type of all arguments - * @param <Z> the type of the result of the operation - */ - @FunctionalInterface - static interface QuadOperator<X, Z> extends QuadFunction<X, X, X, X, Z> {} - -} http://git-wip-us.apache.org/repos/asf/jena/blob/e633f334/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/TetraOperator.java ---------------------------------------------------------------------- diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/TetraOperator.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/TetraOperator.java new file mode 100644 index 0000000..03cc7ac --- /dev/null +++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/tuple/TetraOperator.java @@ -0,0 +1,12 @@ +package org.apache.jena.atlas.lib.tuple; + +import org.apache.jena.atlas.function.TetraFunction; + +/** + * A specialization of {@link TetraFunction} in which all arguments are of the same type. + * + * @param <X> the type of all arguments + * @param <Z> the type of the result of the operation + */ +@FunctionalInterface +public interface TetraOperator<X, Z> extends TetraFunction<X, X, X, X, Z> {} \ No newline at end of file
