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/03/11 18:28:42 UTC
[16/19] incubator-tinkerpop git commit: Remove the TimeUtils class by
pushing its methods to the existing TimeUtil class.
Remove the TimeUtils class by pushing its methods to the existing TimeUtil class.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/f52f6cbd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/f52f6cbd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/f52f6cbd
Branch: refs/heads/newapi
Commit: f52f6cbd67b8da9696d5cd18ea03e06934514c77
Parents: 010fe19
Author: Stephen Mallette <sp...@apache.org>
Authored: Wed Mar 11 10:20:34 2015 -0400
Committer: Stephen Mallette <sp...@apache.org>
Committed: Wed Mar 11 10:20:34 2015 -0400
----------------------------------------------------------------------
.../apache/tinkerpop/gremlin/util/TimeUtil.java | 15 ++++++++
.../tinkerpop/gremlin/util/tools/TimeUtils.java | 40 --------------------
.../AbstractImportCustomizerProvider.java | 4 +-
3 files changed, 17 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f52f6cbd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/TimeUtil.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/TimeUtil.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/TimeUtil.java
index 5131560..1b0a8e3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/TimeUtil.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/TimeUtil.java
@@ -19,9 +19,11 @@
package org.apache.tinkerpop.gremlin.util;
import java.util.concurrent.TimeUnit;
+import java.util.stream.IntStream;
/**
* @author Stephen Mallette (http://stephen.genoprime.com)
+ * @author Daniel Kuppitz (http://gremlin.guru)
*/
public final class TimeUtil {
public static long secondsSince(final long startNanos) {
@@ -39,4 +41,17 @@ public final class TimeUtil {
public static long timeSince(final long startNanos, final TimeUnit destUnit) {
return destUnit.convert(System.nanoTime() - startNanos, TimeUnit.NANOSECONDS);
}
+
+ public static double clock(final Runnable runnable) {
+ return clock(100, runnable);
+ }
+
+ public static double clock(final int loops, final Runnable runnable) {
+ runnable.run(); // warm-up
+ return IntStream.range(0, loops).mapToDouble(i -> {
+ long t = System.nanoTime();
+ runnable.run();
+ return (System.nanoTime() - t) * 0.000001;
+ }).sum() / loops;
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f52f6cbd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/tools/TimeUtils.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/tools/TimeUtils.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/tools/TimeUtils.java
deleted file mode 100644
index a8d4788..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/tools/TimeUtils.java
+++ /dev/null
@@ -1,40 +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.util.tools;
-
-import java.util.stream.IntStream;
-
-/**
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public class TimeUtils {
-
- public static double clock(final Runnable runnable) {
- return clock(100, runnable);
- }
-
- public static double clock(final int loops, final Runnable runnable) {
- runnable.run(); // warm-up
- return IntStream.range(0, loops).mapToDouble(i -> {
- long t = System.nanoTime();
- runnable.run();
- return (System.nanoTime() - t) * 0.000001;
- }).sum() / loops;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f52f6cbd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
index ab983e9..6ee6afd 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/AbstractImportCustomizerProvider.java
@@ -55,7 +55,7 @@ import org.apache.tinkerpop.gremlin.structure.util.batch.BatchGraph;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedElement;
import org.apache.tinkerpop.gremlin.util.Gremlin;
import org.apache.tinkerpop.gremlin.util.function.FunctionUtils;
-import org.apache.tinkerpop.gremlin.util.tools.TimeUtils;
+import org.apache.tinkerpop.gremlin.util.TimeUtil;
import org.codehaus.groovy.control.customizers.CompilationCustomizer;
import org.codehaus.groovy.control.customizers.ImportCustomizer;
@@ -128,7 +128,7 @@ public abstract class AbstractImportCustomizerProvider implements ImportCustomiz
staticImports.add(Order.class.getCanonicalName() + DOT_STAR);
staticImports.add(Operator.class.getCanonicalName() + DOT_STAR);
staticImports.add(Scope.class.getCanonicalName() + DOT_STAR);
- staticImports.add(TimeUtils.class.getCanonicalName() + DOT_STAR);
+ staticImports.add(TimeUtil.class.getCanonicalName() + DOT_STAR);
staticImports.add(VertexProperty.Cardinality.class.getCanonicalName() + DOT_STAR);
}