]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.db.procore.cluster;\r
13 \r
14 import org.simantics.db.exception.DatabaseException;\r
15 import org.simantics.db.impl.ClusterI;\r
16 import org.simantics.db.impl.IntAllocatorI;\r
17 import org.simantics.db.impl.Modifier;\r
18 \r
19 final class TableIntSet2 {\r
20     public static final int HeaderSize = IntHash.HeaderSize;\r
21     static int create(int[] keys, int vals[], IntAllocatorI allocator) {\r
22         return IntHash2.create(keys, vals, allocator);\r
23     }\r
24 \r
25     /**\r
26      * @param table\r
27      * @param base\r
28      * @param object\r
29      * @param allocator\r
30      * @return base if object was actually added. Base can be new if new memory is allocated.\r
31      */\r
32     static int addInt(int[] table, int base, int key, int val, IntAllocatorI allocator) {\r
33         return IntHash2.add(table, base, key, val, allocator);\r
34     }\r
35     \r
36     static boolean removeInt(int[] table, int base, int key) {\r
37         return IntHash2.remove(table, base, key);\r
38     }\r
39 \r
40     static int getSize(int[] table, int base) {\r
41         return IntHash2.getUsedSize(table, base);\r
42     }\r
43     \r
44     static int getAllocatedSize(int[] table, int base) {\r
45         return IntHash2.getAllocatedSize(table, base);\r
46     }\r
47     \r
48     static <Context> boolean foreachInt(int[] table, int base\r
49                 , ClusterI.PredicateProcedure<Context> procedure, Context context, Modifier modifier) throws DatabaseException {\r
50         return IntHash2.foreachInt(table, base, procedure, context, modifier);\r
51     }\r
52     \r
53     static boolean contains(int[] table, int base, int key) {\r
54         return IntHash2.contains(table, base, key);\r
55     }\r
56     static int get(int[] table, int base, int key) {\r
57         return IntHash2.get(table, base, key);\r
58     }\r
59 }\r
60 \r