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