]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntSet.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.db.procore / src / org / simantics / db / procore / cluster / TableIntSet.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.Resource;\r
15 import org.simantics.db.exception.DatabaseException;\r
16 import org.simantics.db.impl.ClusterI;\r
17 import org.simantics.db.impl.IntAllocatorI;\r
18 import org.simantics.db.impl.Modifier;\r
19 import org.simantics.db.impl.graph.ReadGraphImpl;\r
20 import org.simantics.db.impl.query.QueryProcessor;\r
21 import org.simantics.db.procedure.AsyncMultiProcedure;\r
22 \r
23 final class TableIntSet {\r
24     public static final int HeaderSize = IntHash.HeaderSize;\r
25 //    static int create(int initialSize, IntAllocatorI allocator) {\r
26 //        return IntHash.create(initialSize, allocator);\r
27 //    }\r
28     static int create(int[] ints, IntAllocatorI allocator) {\r
29         return IntHash.create(ints, allocator);\r
30     }\r
31 \r
32     /**\r
33      * @param table\r
34      * @param base\r
35      * @param object\r
36      * @param allocator\r
37      * @return true if object was actually added.\r
38      */\r
39     static int addInt(int[] table, int base, int object, IntAllocatorI allocator) {\r
40         return IntHash.add(table, base, object, allocator);\r
41     }\r
42     \r
43     static boolean removeInt(int[] table, int base, int object) {\r
44         return IntHash.remove(table, base, object);\r
45     }\r
46 \r
47     static int removeIntLast(int[] table, int base)\r
48     throws DatabaseException {\r
49         return IntHash.removeLast(table, base);\r
50     }\r
51 \r
52     static int getSize(int[] table, int base) {\r
53         return IntHash.getUsedSize(table, base);\r
54     }\r
55     \r
56     static int getAllocatedSize(int[] table, int base) {\r
57         return IntHash.getAllocatedSize(table, base);\r
58     }\r
59     \r
60     static void foreachInt(int[] table, int base, QueryProcessor processor, ReadGraphImpl graph, AsyncMultiProcedure<Resource> procedure, Modifier modifier) throws DatabaseException {\r
61         IntHash.foreachInt(graph, table, base, procedure, modifier);\r
62     }\r
63 \r
64     static <Context> boolean foreachInt(int[] table, int base\r
65                 , ClusterI.ObjectProcedure<Context> procedure, Context context, Modifier modifier) throws DatabaseException {\r
66         return IntHash.foreachInt(table, base, procedure, context, modifier);\r
67     }\r
68     \r
69     static boolean contains(int[] table, int base, int a) {\r
70         return IntHash.contains(table, base, a);\r
71     }\r
72 }\r
73 \r