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%2FTableIntArraySet.java;fp=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FTableIntArraySet.java;h=df5920c47b611463a08025aa9428c678666abf1d;hp=8161cd80d934d2c9d12a02ba2132520c811d2ed4;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntArraySet.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntArraySet.java index 8161cd80d..df5920c47 100644 --- a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntArraySet.java +++ b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/TableIntArraySet.java @@ -1,235 +1,235 @@ -/******************************************************************************* - * 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.Resource; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.impl.ClusterI; -import org.simantics.db.impl.IntAllocatorI; -import org.simantics.db.impl.Modifier; -import org.simantics.db.impl.ResourceImpl; -import org.simantics.db.impl.graph.ReadGraphImpl; -import org.simantics.db.procedure.AsyncContextMultiProcedure; -import org.simantics.db.procedure.AsyncMultiProcedure; - -final class TableIntArraySet { - public static final int HeaderSize = 1; - private static final int SIZE_OFFSET = -1; - static int create(final int[] ints, IntAllocatorI allocator) - throws DatabaseException { - final int LENGTH = ints.length*2; - if (LENGTH <1) - throw new DatabaseException("Illegal argument to create TableIntArraySet."); - int newBase = allocator.allocate(LENGTH + HeaderSize) + HeaderSize; - int[] table = allocator.getTable(); - table[newBase + SIZE_OFFSET] = -LENGTH; - for (int i=0; i 0); - Ints it = new Ints(); - int i; - for (i=0; i 0); - it.ints = new int[size+1]; - for (i=0; i 0); - int i; - for (i=0; i 0); - int i; - for (i=0; ii; --end) - if (0 != table[base + end]) - break; - table[base + i] = table[base + end]; - table[base + end] = 0; - return end; - } - - static int removeIntLast(int[] table, int base) - throws DatabaseException { - final int size = getSize(table, base); - if (size != 1) - throw new DatabaseException("Illegal call of TableIntArraySet.removeLastint"); - int t = table[base]; - table[base] = 0; - return t; - } - - 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 void foreachInt(final int[] table, final int base, ReadGraphImpl graph, AsyncMultiProcedure procedure, Modifier modifier) throws DatabaseException { - - final int size = -table[base + SIZE_OFFSET]; - assert(size>0); - for (int i=0; i void foreachInt(final int[] table, final int base, ReadGraphImpl graph, C context, AsyncContextMultiProcedure procedure, Modifier modifier) throws DatabaseException { - - final int size = -table[base + SIZE_OFFSET]; - assert(size>0); - for (int i=0; i0); - for (int i=0; i boolean foreachInt(final int[] table, final int base - , final ClusterI.ObjectProcedure 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); + Ints it = new Ints(); + int i; + for (i=0; i 0); + it.ints = new int[size+1]; + for (i=0; i 0); + int i; + for (i=0; i 0); + int i; + for (i=0; ii; --end) + if (0 != table[base + end]) + break; + table[base + i] = table[base + end]; + table[base + end] = 0; + return end; + } + + static int removeIntLast(int[] table, int base) + throws DatabaseException { + final int size = getSize(table, base); + if (size != 1) + throw new DatabaseException("Illegal call of TableIntArraySet.removeLastint"); + int t = table[base]; + table[base] = 0; + return t; + } + + 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 void foreachInt(final int[] table, final int base, ReadGraphImpl graph, AsyncMultiProcedure procedure, Modifier modifier) throws DatabaseException { + + final int size = -table[base + SIZE_OFFSET]; + assert(size>0); + for (int i=0; i void foreachInt(final int[] table, final int base, ReadGraphImpl graph, C context, AsyncContextMultiProcedure procedure, Modifier modifier) throws DatabaseException { + + final int size = -table[base + SIZE_OFFSET]; + assert(size>0); + for (int i=0; i0); + for (int i=0; i boolean foreachInt(final int[] table, final int base + , final ClusterI.ObjectProcedure procedure, final Context context, final Modifier modifier) throws DatabaseException { + final int size = -table[base + SIZE_OFFSET]; + assert(size>0); + for (int i=0; i