protected final void setPrimaryKeyFormatter(final GemFireContainer container, TableDescriptor td, final int[] pkColumns) { final TIntArrayList fixedCols = new TIntArrayList(pkColumns.length); final TIntArrayList varCols = new TIntArrayList(pkColumns.length); // since PK bytes are persisted and compared directly, we do not want any // schema version; keeping it as fixed zero for consistency across different // rows; this may need to be revisited in future if we allow for changing // PK columns also with data this.pkFormatter = getRowFormatter(pkColumns, container, td, fixedCols, varCols, 0, true); if (fixedCols.size() > 0) { this.primaryKeyFixedColumns = fixedCols.toNativeArray(); } else { this.primaryKeyFixedColumns = null; } if (varCols.size() > 0) { this.primaryKeyVarColumns = varCols.toNativeArray(); } else { this.primaryKeyVarColumns = null; } }
/** * Searches the list for values satisfying <tt>condition</tt> in * the manner of the *nix <tt>grep</tt> utility. * * @param condition a condition to apply to each element in the list * @return a list of values which match the condition. */ public TIntArrayList grep(TIntProcedure condition) { TIntArrayList list = new TIntArrayList(); for (int i = 0; i < _pos; i++) { if (condition.execute(_data[i])) { list.add(_data[i]); } } return list; }
/** * Sheds any excess capacity above and beyond the current size of * the list. */ public void trimToSize() { if (_data.length > size()) { int[] tmp = new int[size()]; toNativeArray(tmp, 0, tmp.length); _data = tmp; } }
@Override public long createSort(Properties implParameters, ExecRow template, ColumnOrdering[] columnOrdering, SortObserver sortObserver, boolean alreadyInOrder, long estimatedRows, int estimatedRowSize, long maxSortLimit) throws StandardException { final ArraySorter sort = ArraySorter.create(this, columnOrdering, sortObserver, alreadyInOrder, estimatedRows, estimatedRowSize, maxSortLimit); // Add the sort to the sorts vector if (this.sorts == null) { this.sorts = new ArrayList<Sort>(4); this.freeSortIds = new TIntArrayList(4); } int sortId; if (this.freeSortIds.isEmpty()) { // no free identifiers, add sort at the end sortId = this.sorts.size(); this.sorts.add(sort); } else { // reuse a sort identifier sortId = freeSortIds.remove(freeSortIds.size() - 1); this.sorts.set(sortId, sort); } return sortId; }
/** * Adds the values in the array <tt>vals</tt> to the end of the * list, in order. * * @param vals an <code>int[]</code> value */ public void add(int[] vals) { add(vals, 0, vals.length); }
final LogWriterI18n logger = region.getLogWriterI18n(); final int numKeys = this.membersToKeys.size(); final TIntArrayList bucketList = new TIntArrayList(this.bucketBitSet.size()); int count = countItr.next(); for (int i = 0; i < count; i++) { bucketList.add(bucketId); this.getID() + ".execute: Got keys " + this.membersToKeys + " of size [" + numKeys + "] " + " with bucketList " + bucketList + " of size [" + bucketList.size() + "] " + " for region " + this.region.getFullPath() + " , processorId=" + getProcessorId() + " , and callbackArg " SanityManager.ASSERT(numKeys == bucketList.size()); while (keyAndBucketIndex < numKeys) { final Object key = this.membersToKeys.get(keyAndBucketIndex); final int bucketId = bucketList.get(keyAndBucketIndex); Object result = null; try {
public final void initializeLobFinalizers(TIntArrayList lobIndices, CreateLobFinalizer createLobFinalizer) { final Object[] nonPrimitives = this.nonPrimitives; int lobIndex; final int size = lobIndices.size(); for (int index = 0; index < size; index++) { lobIndex = lobIndices.getQuick(index); if (lobIndex >= 0) { nonPrimitives[lobIndex + 1] = createLobFinalizer .execute((BlobChunk)nonPrimitives[lobIndex]); } else { lobIndex = -lobIndex - 1; nonPrimitives[lobIndex + 1] = createLobFinalizer .execute((ClobChunk)nonPrimitives[lobIndex]); } } }
public Object create() { TIntArrayList list = new TIntArrayList(); for (int i = 0; i < 1000; i++) { list.add(i); } list.trimToSize(); return list; } }
/** * Creates a new <code>TIntStack</code> instance with the * specified capacity. * * @param capacity the initial depth of the stack */ public TIntStack(int capacity) { _list = new TIntArrayList(capacity); }
RowFormatter pkrf = tableInfo.getPrimaryKeyFormatter(); if (pkrf != null) { final TIntArrayList fixedCols = new TIntArrayList( pkrf.getNumColumns()); final TIntArrayList varCols = new TIntArrayList(pkrf.getNumColumns()); getFixedAndVarColumns(pkrf, fixedCols, varCols); int keyIndex, offset, width, offsetFromMap; int varOffset = 0; final int numFixedCols = fixedCols.size(); if (numFixedCols > 0) { for (int index = 0; index < numFixedCols; ++index) { keyIndex = fixedCols.getQuick(index) - 1; offsetFromMap = pkrf.positionMap[keyIndex]; width = pkrf.getColumnDescriptor(keyIndex).fixedWidth; final int numVarWidths = varCols.size(); if (numVarWidths > 0) { keyIndex = varCols.getQuick(index) - 1; offsetFromMap = pkrf.positionMap[keyIndex]; assert offsetFromMap <= 0 : "unexpected offsetFromMap="
try { final TIntArrayList columnsList = new TIntArrayList(4); SharedUtils.splitCSV(projection, projectionAgg, columnsList, null); int[] columns = columnsList.toNativeArray(); String rowBufferTable = GemFireContainer.getRowBufferTableName(columnTable); authorizeTableOperation(lcc, rowBufferTable, columns,
/** * Inserts <tt>value</tt> into the list at <tt>offset</tt>. All * values including and to the right of <tt>offset</tt> are shifted * to the right. * * @param offset an <code>int</code> value * @param value an <code>int</code> value */ public void insert(int offset, int value) { if (offset == _pos) { add(value); return; } ensureCapacity(_pos + 1); // shift right System.arraycopy(_data, offset, _data, offset + 1, _pos - offset); // insert _data[offset] = value; _pos++; }
/** * Returns the current depth of the stack. * * @return an <code>int</code> value */ public int size() { return _list.size(); }
public String toString() { StringBuilder sb = new StringBuilder(); for(int i=0; i<this.hosts.size(); i++) { if (i == 0) { sb.append("alias="); sb.append(this.alias); sb.append(";"); sb.append(" hostports: "); } sb.append(this.hosts.get(i)); sb.append(":"); sb.append(this.ports.get(i)); sb.append(" "); } return sb.toString(); }