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%2FTableIntArraySet2.java;fp=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FTableIntArraySet2.java;h=e09599505d3bc978319fd4603c2edaeedd94b479;hp=b9611196d8c24fed77cb446de27310b0835d7d58;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntArraySet2.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntArraySet2.java index b9611196d..e09599505 100644 --- a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntArraySet2.java +++ b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntArraySet2.java @@ -1,176 +1,176 @@ -/******************************************************************************* - * 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 TableIntArraySet2 { - public static final int HeaderSize = 1; - private static final int SIZE_OFFSET = -1; - static int create(final int[] keys, final int[] vals, IntAllocatorI allocator) - throws DatabaseException { - final int LENGTH = keys.length; - if (LENGTH < 1 || LENGTH != vals.length) - throw new DatabaseException("Illegal argument to create TableIntArraySet2."); - int newBase = allocator.allocate(LENGTH*2 + HeaderSize) + HeaderSize; - int[] table = allocator.getTable(); - table[newBase + SIZE_OFFSET] = -LENGTH; - for (int i=0; i 0); - Tables t = new Tables(); - int i; - for (i=0; i 0); - t.keys = new int[size]; - t.vals = new int[size]; - for (i=0; i 0); - for (int i=0; i 0); - int i; - for (i=0; i 0); - int i; - for (i=0; ii; --end) - if (0 != table[base + end*2]) - break; - table[base + i*2] = table[base + end*2]; - table[base + i*2 + 1] = table[base + end*2 + 1]; - table[base + end*2] = 0; - table[base + end*2 + 1] = 0; - return true; - } - - static int getSize(int[] table, int base) { - final int size = -table[base + SIZE_OFFSET]; - assert(size > 0); - int i; - for (i=0; i0); - return size + HeaderSize; - } - - static boolean foreachInt(final int[] table, final int base - , final ClusterI.PredicateProcedure procedure, final Context context, final Modifier modifier) throws DatabaseException { - final int size = -table[base + SIZE_OFFSET]; - assert(size>0); - for (int i=0; i 0); + Tables t = new Tables(); + int i; + for (i=0; i 0); + t.keys = new int[size]; + t.vals = new int[size]; + for (i=0; i 0); + for (int i=0; i 0); + int i; + for (i=0; i 0); + int i; + for (i=0; ii; --end) + if (0 != table[base + end*2]) + break; + table[base + i*2] = table[base + end*2]; + table[base + i*2 + 1] = table[base + end*2 + 1]; + table[base + end*2] = 0; + table[base + end*2 + 1] = 0; + return true; + } + + static int getSize(int[] table, int base) { + final int size = -table[base + SIZE_OFFSET]; + assert(size > 0); + int i; + for (i=0; i0); + return size + HeaderSize; + } + + static boolean foreachInt(final int[] table, final int base + , final ClusterI.PredicateProcedure procedure, final Context context, final Modifier modifier) throws DatabaseException { + final int size = -table[base + SIZE_OFFSET]; + assert(size>0); + for (int i=0; i