]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/IntHashTrait.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.procore / src / org / simantics / db / procore / cluster / IntHashTrait.java
diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/IntHashTrait.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/IntHashTrait.java
new file mode 100644 (file)
index 0000000..02fd1a9
--- /dev/null
@@ -0,0 +1,37 @@
+/*******************************************************************************\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
+public class IntHashTrait {\r
+    public static final boolean isFree(int a) {\r
+        return FREE_VALUE == a;\r
+    }\r
+    public static final boolean isFull(int a) {\r
+       return (a & 0x7fffffff) != 0;\r
+        //return a != FREE_VALUE && a != REMOVED_VALUE;\r
+    }\r
+    public static final boolean isRemoved(int a) {\r
+        return REMOVED_VALUE == a;\r
+    }\r
+    public static final int setFree() {\r
+        return FREE_VALUE;\r
+    }\r
+    public static final int setFull(int a) {\r
+               assert(a != FREE_VALUE && a != REMOVED_VALUE);\r
+        return a;\r
+    }\r
+    public static int setRemoved() {\r
+        return REMOVED_VALUE;\r
+    }\r
+    private static final int FREE_VALUE = 0;\r
+    private static final int REMOVED_VALUE = 0x80000000;\r
+}\r