X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FTableIntSet2.java;fp=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FTableIntSet2.java;h=8110d1a49ee01e6681320da43cf315cd494806b9;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 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 index 000000000..8110d1a49 --- /dev/null +++ b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntSet2.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.db.procore.cluster; + +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.impl.ClusterI; +import org.simantics.db.impl.IntAllocatorI; +import org.simantics.db.impl.Modifier; + +final class TableIntSet2 { + public static final int HeaderSize = IntHash.HeaderSize; + static int create(int[] keys, int vals[], IntAllocatorI allocator) { + return IntHash2.create(keys, vals, allocator); + } + + /** + * @param table + * @param base + * @param object + * @param allocator + * @return base if object was actually added. Base can be new if new memory is allocated. + */ + static int addInt(int[] table, int base, int key, int val, IntAllocatorI allocator) { + return IntHash2.add(table, base, key, val, allocator); + } + + static boolean removeInt(int[] table, int base, int key) { + return IntHash2.remove(table, base, key); + } + + static int getSize(int[] table, int base) { + return IntHash2.getUsedSize(table, base); + } + + static int getAllocatedSize(int[] table, int base) { + return IntHash2.getAllocatedSize(table, base); + } + + static boolean foreachInt(int[] table, int base + , ClusterI.PredicateProcedure procedure, Context context, Modifier modifier) throws DatabaseException { + return IntHash2.foreachInt(table, base, procedure, context, modifier); + } + + static boolean contains(int[] table, int base, int key) { + return IntHash2.contains(table, base, key); + } + static int get(int[] table, int base, int key) { + return IntHash2.get(table, base, key); + } +} +