1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.db.procore.cluster;
\r
14 import org.simantics.db.exception.DatabaseException;
\r
15 import org.simantics.db.impl.ClusterI.Procedure;
\r
16 import org.simantics.db.impl.ClusterSupport;
\r
17 import org.simantics.db.impl.Modifier;
\r
18 import org.simantics.db.impl.Table;
\r
19 import org.simantics.db.impl.TableFactory;
\r
20 import org.simantics.db.impl.TableSizeListener;
\r
22 public class ArgumentTable extends Table<long[]> {
\r
23 ArgumentTable(TableSizeListener sizeListener, int[] header, int headerBase, long[] longs) {
\r
24 super(TableFactory.getLongFactory(), sizeListener, header, headerBase, longs);
\r
26 int createArgument(long a1) {
\r
27 int tableIndex = createNewElement(1);
\r
28 int realIndex = checkIndexAndGetRealIndex(tableIndex, 1);
\r
29 long[] table = getTable();
\r
30 table[realIndex] = a1;
\r
33 int createArgument(long a1, long a2) {
\r
34 int tableIndex = createNewElement(2);
\r
35 int realIndex = checkIndexAndGetRealIndex(tableIndex, 2);
\r
36 long[] table = getTable();
\r
37 table[realIndex] = a1;
\r
38 table[++realIndex] = a2;
\r
41 int createArgument(long a1, long a2, long a3, long a4, long a5) {
\r
42 int tableIndex = createNewElement(5);
\r
43 int realIndex = checkIndexAndGetRealIndex(tableIndex, 5);
\r
44 long[] table = getTable();
\r
45 table[realIndex] = a1;
\r
46 table[++realIndex] = a2;
\r
47 table[++realIndex] = a3;
\r
48 table[++realIndex] = a4;
\r
49 table[++realIndex] = a5;
\r
52 long[] getArguments(int argIndex, int size) {
\r
53 int realIndex = checkIndexAndGetRealIndex(argIndex, size);
\r
54 long[] table = getTable();
\r
55 long[] dest = new long[size];
\r
56 System.arraycopy(table, realIndex, dest, 0, size);
\r
60 public <Context> boolean foreach(int setIndex, Procedure procedure, Context context,
\r
61 ClusterSupport support, Modifier modifier) throws DatabaseException {
\r
62 throw new UnsupportedOperationException();
\r