Stepan Koltsov avatar Stepan Koltsov committed a3e7aea

move files

Comments (0)

Files changed (1)

src/java/org/jetbrains/jet/perf/TestUtils.java

+package org.jetbrains.jet.perf;
+
+import org.jetbrains.jet.perf.iteratorList.lib.Function;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Stepan Koltsov
+ */
+public class TestUtils {
+    public static void printenv(Class<?> testClass) {
+        System.out.println(testClass.getName());
+        System.out.println(System.getProperty("java.version"));
+    }
+    
+    public static List<Integer> makeListWithInts(int count, int seed) {
+        List<Integer> r = new ArrayList<Integer>();
+        for (int i = 0; i < count; ++i) {
+            r.add(hash(i, seed));
+        }
+        return r;
+    }
+
+    public static int sum(List<Integer> list) {
+        int r = 0;
+        for (Integer i : list) {
+            r += i;
+        }
+        return r;
+    }
+
+    public static int hash(int i, int seed) {
+        return i * seed * 0x9e3779b1;
+    }
+
+    public static Function<Integer, Integer> plus1F() {
+        return new Function<Integer, Integer>() {
+            @Override
+            public Integer apply(Integer integer) {
+                return integer + 1;
+            }
+        };
+    }
+
+    public static Function<Integer, Boolean> positiveF() {
+        return new Function<Integer, Boolean>() {
+            @Override
+            public Boolean apply(Integer integer) {
+                return integer > 0;
+            }
+        };
+    }
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.