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%2FArgumentTable.java;fp=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FArgumentTable.java;h=7a5917206e4847cbc89ab32a095d67c7aa370a52;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ArgumentTable.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ArgumentTable.java new file mode 100644 index 000000000..7a5917206 --- /dev/null +++ b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ArgumentTable.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * 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.Procedure; +import org.simantics.db.impl.ClusterSupport; +import org.simantics.db.impl.Modifier; +import org.simantics.db.impl.Table; +import org.simantics.db.impl.TableFactory; +import org.simantics.db.impl.TableSizeListener; + +public class ArgumentTable extends Table { + ArgumentTable(TableSizeListener sizeListener, int[] header, int headerBase, long[] longs) { + super(TableFactory.getLongFactory(), sizeListener, header, headerBase, longs); + } + int createArgument(long a1) { + int tableIndex = createNewElement(1); + int realIndex = checkIndexAndGetRealIndex(tableIndex, 1); + long[] table = getTable(); + table[realIndex] = a1; + return tableIndex; + } + int createArgument(long a1, long a2) { + int tableIndex = createNewElement(2); + int realIndex = checkIndexAndGetRealIndex(tableIndex, 2); + long[] table = getTable(); + table[realIndex] = a1; + table[++realIndex] = a2; + return tableIndex; + } + int createArgument(long a1, long a2, long a3, long a4, long a5) { + int tableIndex = createNewElement(5); + int realIndex = checkIndexAndGetRealIndex(tableIndex, 5); + long[] table = getTable(); + table[realIndex] = a1; + table[++realIndex] = a2; + table[++realIndex] = a3; + table[++realIndex] = a4; + table[++realIndex] = a5; + return tableIndex; + } + long[] getArguments(int argIndex, int size) { + int realIndex = checkIndexAndGetRealIndex(argIndex, size); + long[] table = getTable(); + long[] dest = new long[size]; + System.arraycopy(table, realIndex, dest, 0, size); + return dest; + } + @Override + public boolean foreach(int setIndex, Procedure procedure, Context context, + ClusterSupport support, Modifier modifier) throws DatabaseException { + throw new UnsupportedOperationException(); + } +}