You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/04/24 15:10:26 UTC
incubator-tinkerpop git commit: Drop usage of EdgeTerminator and
delete some dead code.
Repository: incubator-tinkerpop
Updated Branches:
refs/heads/refactor-io 1132d8ab6 -> 4c29a831a
Drop usage of EdgeTerminator and delete some dead code.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/4c29a831
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/4c29a831
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/4c29a831
Branch: refs/heads/refactor-io
Commit: 4c29a831a3d8994b2590af03bf0b005bf0169d62
Parents: 1132d8a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 24 09:09:44 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 24 09:09:44 2015 -0400
----------------------------------------------------------------------
.../structure/io/gryo/EdgeTerminator.java | 48 --------------------
.../gremlin/structure/io/gryo/GryoMapper.java | 5 +-
.../gremlin/structure/io/gryo/GryoReader.java | 3 +-
.../gremlin/structure/io/gryo/GryoWriter.java | 48 +-------------------
.../tinkerpop/gremlin/structure/IoTest.java | 1 -
5 files changed, 5 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c29a831/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EdgeTerminator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EdgeTerminator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EdgeTerminator.java
deleted file mode 100644
index 12848cf..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/EdgeTerminator.java
+++ /dev/null
@@ -1,48 +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.structure.io.gryo;
-
-/**
- * Represents the end of an edge list in a serialization stream.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-class EdgeTerminator {
- public static final EdgeTerminator INSTANCE = new EdgeTerminator();
- private final boolean terminal;
-
- private EdgeTerminator() {
- this.terminal = true;
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- final EdgeTerminator that = (EdgeTerminator) o;
-
- return terminal == that.terminal;
- }
-
- @Override
- public int hashCode() {
- return (terminal ? 1 : 0);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c29a831/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
index 8d2b430..85b599a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoMapper.java
@@ -174,7 +174,7 @@ public final class GryoMapper implements Mapper<Kryo> {
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedProperty.class, null, 18));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedVertex.class, null, 19));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(DetachedPath.class, null, 60));
- add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(EdgeTerminator.class, null, 14));
+ // skip 14
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(EnumSet.class, null, 46));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(HashMap.class, null, 11));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(HashMap.Entry.class, null, 16));
@@ -207,8 +207,7 @@ public final class GryoMapper implements Mapper<Kryo> {
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Property.class, kryo -> new GraphSerializer.PropertySerializer(), 67));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(VertexProperty.class, kryo -> new GraphSerializer.VertexPropertySerializer(), 68));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Path.class, kryo -> new GraphSerializer.PathSerializer(), 59));
- // HACK!
- //add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(Traverser.Admin.class, gryo -> new GraphSerializer.TraverserSerializer(), 55));
+ // skip 55
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(B_O_Traverser.class, null, 75));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(O_Traverser.class, null, 76));
add(Triplet.<Class, Function<Kryo, Serializer>, Integer>with(B_O_P_S_SE_SL_Traverser.class, null, 77));
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c29a831/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
index f0ee1a9..d372b44 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoReader.java
@@ -126,7 +126,8 @@ public class GryoReader implements GraphReader {
final Map<Vertex,Vertex> cache = new HashMap<>();
IteratorUtils.iterate(new VertexInputIterator(new Input(inputStream), attachable ->
cache.put(attachable.get(), attachable.attach(graphToWriteTo, Attachable.Method.CREATE))));
- cache.entrySet().forEach(kv -> kv.getKey().edges(Direction.OUT).forEachRemaining(e -> ((Attachable) e).attach(kv.getValue(), Attachable.Method.CREATE)));
+ cache.entrySet().forEach(kv -> kv.getKey().edges(Direction.OUT)
+ .forEachRemaining(e -> ((Attachable) e).attach(kv.getValue(), Attachable.Method.CREATE)));
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c29a831/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
index b254df7..88fb325 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoWriter.java
@@ -33,7 +33,6 @@ import org.apache.tinkerpop.shaded.kryo.io.Output;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.HashMap;
import java.util.Iterator;
/**
@@ -106,7 +105,7 @@ public class GryoWriter implements GraphWriter {
output.flush();
}
- public void writeVertexInternal(final Output output, final Vertex v) throws IOException {
+ void writeVertexInternal(final Output output, final Vertex v) throws IOException {
writeHeader(output);
kryo.writeObject(output, StarGraph.of(v));
kryo.writeClassAndObject(output, VertexTerminator.INSTANCE);
@@ -116,51 +115,6 @@ public class GryoWriter implements GraphWriter {
output.writeBytes(GryoMapper.HEADER);
}
- private void writeEdgeToOutput(final Output output, final Edge e) {
- this.writeElement(output, e, null);
- }
-
- private void writeVertexWithNoEdgesToOutput(final Output output, final Vertex v) {
- writeElement(output, v, null);
- }
-
- private void writeVertexToOutput(final Output output, final Vertex v, final Direction direction) {
- this.writeElement(output, v, direction);
- }
-
- private void writeElement(final Output output, final Element e, final Direction direction) {
- kryo.writeClassAndObject(output, e);
-
- if (e instanceof Vertex) {
- output.writeBoolean(direction != null);
- if (direction != null) {
- final Vertex v = (Vertex) e;
- kryo.writeObject(output, direction);
- if (direction == Direction.BOTH || direction == Direction.OUT)
- writeDirectionalEdges(output, Direction.OUT, v.edges(Direction.OUT));
-
- if (direction == Direction.BOTH || direction == Direction.IN)
- writeDirectionalEdges(output, Direction.IN, v.edges(Direction.IN));
- }
-
- kryo.writeClassAndObject(output, VertexTerminator.INSTANCE);
- }
- }
-
- private void writeDirectionalEdges(final Output output, final Direction d, final Iterator<Edge> vertexEdges) {
- final boolean hasEdges = vertexEdges.hasNext();
- kryo.writeObject(output, d);
- output.writeBoolean(hasEdges);
-
- while (vertexEdges.hasNext()) {
- final Edge edgeToWrite = vertexEdges.next();
- writeEdgeToOutput(output, edgeToWrite);
- }
-
- if (hasEdges)
- kryo.writeClassAndObject(output, EdgeTerminator.INSTANCE);
- }
-
public static Builder build() {
return new Builder();
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c29a831/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index 3b053db..bc26053 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -57,7 +57,6 @@ import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
import org.apache.tinkerpop.gremlin.util.StreamFactory;
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import javax.xml.XMLConstants;