You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2015/06/03 02:12:18 UTC

[13/50] [abbrv] incubator-tinkerpop git commit: Removed ElementHelper.getOrCreate()

Removed ElementHelper.getOrCreate()

The method wasn't in use and it seemed a bit naive in its implementation.  It assumed that the user was working with a Graph that supportsUserSuppliedIds and only involved id lookup.  Real-world getOrCreate tends to be more complex.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/c1d15cad
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/c1d15cad
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/c1d15cad

Branch: refs/heads/preprocessor
Commit: c1d15cad58860f35ce53039cd5f425f9f4f3212e
Parents: 530c63e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri May 29 12:52:59 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri May 29 12:52:59 2015 -0400

----------------------------------------------------------------------
 .../gremlin/structure/util/ElementHelper.java   | 22 +-------------------
 1 file changed, 1 insertion(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c1d15cad/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
index 931f1ae..024e07f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java
@@ -48,8 +48,7 @@ import java.util.stream.Stream;
  */
 public final class ElementHelper {
 
-    private ElementHelper() {
-    }
+    private ElementHelper() {}
 
     /**
      * Determine whether the Element label can be legally set. This is typically used as a pre-condition check.
@@ -66,25 +65,6 @@ public final class ElementHelper {
             throw Element.Exceptions.labelCanNotBeAHiddenKey(label);
     }
 
-    /*public static void validateLabels(final String... labels) throws IllegalArgumentException {
-        for (final String label : labels) {
-            validateLabel(label);
-        }
-    }*/
-
-    /**
-     * Check if the vertex, by ID, exists. If it does return it, else create it and return it.
-     *
-     * @param graph the graph to check for the existence of the vertex
-     * @param id    the id of the vertex to look for
-     * @param label the label of the vertex to set if the vertex does not exist
-     * @return a pre-existing vertex or a newly created vertex
-     */
-    public static Vertex getOrAddVertex(final Graph graph, final Object id, final String label) {
-        final Iterator<Vertex> iterator = graph.vertices(id);
-        return iterator.hasNext() ? iterator.next() : graph.addVertex(T.id, id, T.label, label);
-    }
-
     /**
      * Determines whether the property key/value for the specified thing can be legally set. This is typically used as
      * a pre-condition check prior to setting a property.