X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FForeignTableSmall.java;fp=bundles%2Forg.simantics.db.procore%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fprocore%2Fcluster%2FForeignTableSmall.java;h=6c9db07b618f2d6e75582e4b2453aacec3184948;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ForeignTableSmall.java b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ForeignTableSmall.java new file mode 100644 index 000000000..6c9db07b6 --- /dev/null +++ b/bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ForeignTableSmall.java @@ -0,0 +1,156 @@ +/******************************************************************************* + * 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.ClusterBase; +import org.simantics.db.impl.ClusterI; +import org.simantics.db.impl.ClusterI.Procedure; +import org.simantics.db.impl.ClusterSupport; +import org.simantics.db.impl.ClusterTraitsBase; +import org.simantics.db.impl.IClusterTable; +import org.simantics.db.impl.Modifier; +import org.simantics.db.impl.Table; +import org.simantics.db.impl.TableFactory; +import org.simantics.db.service.ClusterUID; +import org.simantics.db.service.ResourceUID; + +import gnu.trove.map.hash.TIntShortHashMap; + +final public class ForeignTableSmall extends Table +{ + private IClusterTable clusterTable; + public ForeignTableSmall(ClusterBase sizeListener, int[] header, int headerBase) { + super(TableFactory.getLongFactory(), sizeListener, header, headerBase); + this.clusterTable = sizeListener.getClusterTable(); + } + public ForeignTableSmall(ClusterBase sizeListener, int[] header, int headerBase, long[] longs) { + super(TableFactory.getLongFactory(), sizeListener, header, headerBase, longs); + this.clusterTable = sizeListener.getClusterTable(); + } + public int getUsedSize() { + return getTableCount(); + } + static long rmTime = 0; + public TIntShortHashMap getResourceHashMap() + throws DatabaseException { +// long start = System.nanoTime(); + int ELEMENT_SIZE = ForeignElement.getSizeOf(); + assert(ELEMENT_SIZE == 3); + final int TABLE_SIZE = getTableCount(); + final int FOREIGN_COUNT = getForeignCount(); + final int BASE = this.getTableBase(); + final int TOP = BASE + TABLE_SIZE * ELEMENT_SIZE; + long[] table = this.getTable(); + int count = 0; + int index = ZERO_SHIFT; + + long firstCache = 0; + long secondCache = 0; + int clusterKeyCache = 0; + + TIntShortHashMap hm = new TIntShortHashMap(FOREIGN_COUNT); + for (int i=BASE; i boolean foreach(int setIndex, Procedure procedure, Context context, + ClusterSupport support, Modifier modifier) throws DatabaseException { + throw new UnsupportedOperationException(); + } +}