]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntSet2.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.procore / src / org / simantics / db / procore / cluster / TableIntSet2.java
diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntSet2.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntSet2.java
new file mode 100644 (file)
index 0000000..8110d1a
--- /dev/null
@@ -0,0 +1,60 @@
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ *     VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.db.procore.cluster;\r
+\r
+import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.db.impl.ClusterI;\r
+import org.simantics.db.impl.IntAllocatorI;\r
+import org.simantics.db.impl.Modifier;\r
+\r
+final class TableIntSet2 {\r
+    public static final int HeaderSize = IntHash.HeaderSize;\r
+    static int create(int[] keys, int vals[], IntAllocatorI allocator) {\r
+        return IntHash2.create(keys, vals, allocator);\r
+    }\r
+\r
+    /**\r
+     * @param table\r
+     * @param base\r
+     * @param object\r
+     * @param allocator\r
+     * @return base if object was actually added. Base can be new if new memory is allocated.\r
+     */\r
+    static int addInt(int[] table, int base, int key, int val, IntAllocatorI allocator) {\r
+        return IntHash2.add(table, base, key, val, allocator);\r
+    }\r
+    \r
+    static boolean removeInt(int[] table, int base, int key) {\r
+        return IntHash2.remove(table, base, key);\r
+    }\r
+\r
+    static int getSize(int[] table, int base) {\r
+        return IntHash2.getUsedSize(table, base);\r
+    }\r
+    \r
+    static int getAllocatedSize(int[] table, int base) {\r
+        return IntHash2.getAllocatedSize(table, base);\r
+    }\r
+    \r
+    static <Context> boolean foreachInt(int[] table, int base\r
+               , ClusterI.PredicateProcedure<Context> procedure, Context context, Modifier modifier) throws DatabaseException {\r
+        return IntHash2.foreachInt(table, base, procedure, context, modifier);\r
+    }\r
+    \r
+    static boolean contains(int[] table, int base, int key) {\r
+        return IntHash2.contains(table, base, key);\r
+    }\r
+    static int get(int[] table, int base, int key) {\r
+        return IntHash2.get(table, base, key);\r
+    }\r
+}\r
+\r