You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/05/15 20:02:57 UTC
incubator-tinkerpop git commit: updated CHANGELOG and renamed
BiPredicateTraveral to TraversalBiPredicate.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/master 01f1fcec4 -> e57634f2b
updated CHANGELOG and renamed BiPredicateTraveral to TraversalBiPredicate.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/e57634f2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/e57634f2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/e57634f2
Branch: refs/heads/master
Commit: e57634f2b9a8ae42a7ceae1789fc72aa1d1f23ab
Parents: 01f1fce
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri May 15 12:02:53 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri May 15 12:02:53 2015 -0600
----------------------------------------------------------------------
CHANGELOG.asciidoc | 2 +
.../traversal/lambda/BiPredicateTraversal.java | 74 --------------------
.../traversal/lambda/TraversalBiPredicate.java | 74 ++++++++++++++++++++
.../traversal/step/filter/WhereStep.java | 8 +--
.../apache/tinkerpop/gremlin/structure/P.java | 4 +-
5 files changed, 82 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e57634f2/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index cf3d22c..5285672 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,8 @@ image::http://www.tinkerpop.com/docs/current/images/gremlin-hindu.png[width=225]
TinkerPop 3.0.0.M9 (NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* `Order.opposite()` is now `reversed()` as that is a `Comparator` interface method with the same semantics.
+* `Compare/Contains/P.opposite()` are now `negate()` as that is a `BiPredicate` interface method with the same semantics.
* `has(traversal)` is replaced by `where(traversal)` and `has(key,traversal)`. `HasXXX` is always with respects to an element property.
* Added `TraversalScriptHelper` with static methods for dynamically creating a `Traversal` from a JSR 223 `ScriptEngine`.
* Changed `SubgraphStrategy` to take `Traversal` rather than `Predicate` for filtering.
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e57634f2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/BiPredicateTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/BiPredicateTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/BiPredicateTraversal.java
deleted file mode 100644
index abaf373..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/BiPredicateTraversal.java
+++ /dev/null
@@ -1,74 +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.tinkerpop.gremlin.process.traversal.lambda;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
-
-import java.util.function.BiPredicate;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class BiPredicateTraversal<S, E> implements BiPredicate<S, E> {
-
- private Traversal.Admin<S, E> traversal;
- private final boolean negate;
-
- public BiPredicateTraversal(final Traversal.Admin<S, E> traversal, final boolean negate) {
- this.traversal = traversal;
- this.negate = negate;
- }
-
- @Override
- public boolean test(final S start, final E end) {
- if (null == start)
- throw new IllegalArgumentException("The traversal must be provided a start: " + this.traversal);
- final boolean result = null == end ? TraversalUtil.test(start, this.traversal) : TraversalUtil.test(start, this.traversal, end);
- return this.negate ? !result : result;
- }
-
- public Traversal.Admin<S, E> getTraversal() {
- return this.traversal;
- }
-
- @Override
- public String toString() {
- return this.traversal.toString();
- }
-
- @Override
- public BiPredicateTraversal<S, E> negate() {
- return new BiPredicateTraversal<>(this.traversal.clone(), !this.negate);
- }
-
- @Override
- public BiPredicateTraversal<S, E> clone() {
- try {
- final BiPredicateTraversal<S, E> clone = (BiPredicateTraversal<S, E>) super.clone();
- clone.traversal = this.traversal.clone();
- return clone;
- } catch (final CloneNotSupportedException e) {
- throw new IllegalStateException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e57634f2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/TraversalBiPredicate.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/TraversalBiPredicate.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/TraversalBiPredicate.java
new file mode 100644
index 0000000..4fba800
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/lambda/TraversalBiPredicate.java
@@ -0,0 +1,74 @@
+/*
+ *
+ * * 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.tinkerpop.gremlin.process.traversal.lambda;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
+
+import java.util.function.BiPredicate;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class TraversalBiPredicate<S, E> implements BiPredicate<S, E> {
+
+ private Traversal.Admin<S, E> traversal;
+ private final boolean negate;
+
+ public TraversalBiPredicate(final Traversal.Admin<S, E> traversal, final boolean negate) {
+ this.traversal = traversal;
+ this.negate = negate;
+ }
+
+ @Override
+ public boolean test(final S start, final E end) {
+ if (null == start)
+ throw new IllegalArgumentException("The traversal must be provided a start: " + this.traversal);
+ final boolean result = null == end ? TraversalUtil.test(start, this.traversal) : TraversalUtil.test(start, this.traversal, end);
+ return this.negate ? !result : result;
+ }
+
+ public Traversal.Admin<S, E> getTraversal() {
+ return this.traversal;
+ }
+
+ @Override
+ public String toString() {
+ return this.traversal.toString();
+ }
+
+ @Override
+ public TraversalBiPredicate<S, E> negate() {
+ return new TraversalBiPredicate<>(this.traversal.clone(), !this.negate);
+ }
+
+ @Override
+ public TraversalBiPredicate<S, E> clone() {
+ try {
+ final TraversalBiPredicate<S, E> clone = (TraversalBiPredicate<S, E>) super.clone();
+ clone.traversal = this.traversal.clone();
+ return clone;
+ } catch (final CloneNotSupportedException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e57634f2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStep.java
index f20518b..9ab81b1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStep.java
@@ -22,7 +22,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Path;
import org.apache.tinkerpop.gremlin.process.traversal.Scope;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.lambda.BiPredicateTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.lambda.TraversalBiPredicate;
import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
@@ -89,7 +89,7 @@ public final class WhereStep<S> extends FilterStep<S> implements TraversalParent
@Override
public List<Traversal.Admin<?, ?>> getLocalChildren() {
- return this.predicate.getBiPredicate() instanceof BiPredicateTraversal ? Collections.singletonList(((BiPredicateTraversal) this.predicate.getBiPredicate()).getTraversal()) : Collections.emptyList();
+ return this.predicate.getBiPredicate() instanceof TraversalBiPredicate ? Collections.singletonList(((TraversalBiPredicate) this.predicate.getBiPredicate()).getTraversal()) : Collections.emptyList();
}
@Override
@@ -100,8 +100,8 @@ public final class WhereStep<S> extends FilterStep<S> implements TraversalParent
@Override
public WhereStep<S> clone() {
final WhereStep<S> clone = (WhereStep<S>) super.clone();
- if (this.predicate.getBiPredicate() instanceof BiPredicateTraversal)
- clone.predicate = P.traversal(((BiPredicateTraversal) this.predicate.getBiPredicate()).getTraversal().clone());
+ if (this.predicate.getBiPredicate() instanceof TraversalBiPredicate)
+ clone.predicate = P.traversal(((TraversalBiPredicate) this.predicate.getBiPredicate()).getTraversal().clone());
return clone;
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/e57634f2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/P.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/P.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/P.java
index d5b54c8..880deff 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/P.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/P.java
@@ -22,7 +22,7 @@
package org.apache.tinkerpop.gremlin.structure;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.lambda.BiPredicateTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.lambda.TraversalBiPredicate;
import org.javatuples.Pair;
import java.io.Serializable;
@@ -134,7 +134,7 @@ public class P<V> implements Predicate<V>, Serializable {
}
public static <S, E> P<S> traversal(final Traversal<S, E> traversal) {
- return new P(new BiPredicateTraversal<>(traversal.asAdmin(), false), null);
+ return new P(new TraversalBiPredicate<>(traversal.asAdmin(), false), null);
}
public static P test(final BiPredicate biPredicate, final Object value) {