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%2FOperationTable.java;fp=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FOperationTable.java;h=d912a1153935c5b4f4cad73078a5ed6786027a6a;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/OperationTable.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/OperationTable.java new file mode 100644 index 000000000..d912a1153 --- /dev/null +++ b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/OperationTable.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * 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 OperationTable extends Table { + + OperationTable(TableSizeListener sizeListener, int[] header, int headerBase, int[] ints) { + super(TableFactory.getIntFactory(), sizeListener, header, headerBase, ints); + } + int getOperationCount() { + return getTableCount(); + } + int createOperation(int type, int argIndex, int valIndex, int valSize) { + int tableIndex = createNewElement(4); + int realIndex = checkIndexAndGetRealIndex(tableIndex, 4); + int[] table = getTable(); + table[realIndex] = type; + table[++realIndex] = argIndex; + table[++realIndex] = valIndex; + table[++realIndex] = valSize; + return tableIndex - ZERO_SHIFT; // operation index is zero based + } + int getOperationType(int opIndex) { + int tableIndex = ZERO_SHIFT + opIndex*4; + int realIndex = checkIndexAndGetRealIndex(tableIndex, 4); + int[] table = getTable(); + return table[realIndex]; + } + int getOperationArgumentIndex(int opIndex) { + int tableIndex = ZERO_SHIFT + opIndex*4; + int realIndex = checkIndexAndGetRealIndex(tableIndex, 4); + int[] table = getTable(); + return table[++realIndex]; + } + int getValueIndex(int opIndex) { + int tableIndex = ZERO_SHIFT + opIndex*4; + int realIndex = checkIndexAndGetRealIndex(tableIndex, 4); + int[] table = getTable(); + return table[realIndex+2]; + } + int getValueSize(int opIndex) { + int tableIndex = ZERO_SHIFT + opIndex*4; + int realIndex = checkIndexAndGetRealIndex(tableIndex, 4); + int[] table = getTable(); + return table[realIndex+3]; + } + @Override + public boolean foreach(int setIndex, Procedure procedure, Context context, + ClusterSupport support, Modifier modifier) throws DatabaseException { + throw new UnsupportedOperationException(); + } +}