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