/** * @return the size of the alias-ordinal mapping */ public int size() { return mAliasToOrdinal.size(); }
/** * @param ordinal a storage tier ordinal * @return the storage tier alias matching the given ordinal */ public String getAlias(int ordinal) { return mAliasToOrdinal.inverse().get(interpretOrdinal(ordinal, mAliasToOrdinal.size())); }
public TierIndexMetaData(final ImmutableBiMap<Byte, Integer> orderedTierIdToSfcIndex) { super(); tierCounts = new int[orderedTierIdToSfcIndex.size()]; this.orderedTierIdToSfcIndex = orderedTierIdToSfcIndex; }
/** * @return the size of the alias-ordinal mapping */ public int size() { return mAliasToOrdinal.size(); }
private ImmutableMap<C, Map<R, V>> makeColumnMap() { ImmutableMap.Builder<C, Map<R, V>> columnMapBuilder = ImmutableMap.builder(); for (int c = 0; c < columnKeyToIndex.size(); c++) { ImmutableMap.Builder<R, V> rowMapBuilder = ImmutableMap.builder(); for (int r = 0; r < rowKeyToIndex.size(); r++) { V value = values[r][c]; if (value != null) { rowMapBuilder.put(rowKeyToIndex.inverse().get(r), value); } } columnMapBuilder.put(columnKeyToIndex.inverse().get(c), rowMapBuilder.build()); } return columnMapBuilder.build(); }
/** * @param ordinal a storage tier ordinal * @return the storage tier alias matching the given ordinal */ public String getAlias(int ordinal) { return mAliasToOrdinal.inverse().get(interpretOrdinal(ordinal, mAliasToOrdinal.size())); }
@Override public byte[] toBinary() { int byteBufferLength = (2 * orderedSfcIndexToTierId.size()); byteBufferLength += VarintUtils.unsignedIntByteLength(orderedSfcs.length); final List<byte[]> orderedSfcBinaries = new ArrayList<>(orderedSfcs.length); byteBufferLength += VarintUtils.unsignedIntByteLength(baseDefinitions.length); final List<byte[]> dimensionBinaries = new ArrayList<>(baseDefinitions.length); byteBufferLength += VarintUtils.unsignedIntByteLength(orderedSfcIndexToTierId.size()); byteBufferLength += VarintUtils.unsignedLongByteLength(maxEstimatedDuplicateIdsPerDimension); for (final SpaceFillingCurve sfc : orderedSfcs) { VarintUtils.writeUnsignedInt(orderedSfcs.length, buf); VarintUtils.writeUnsignedInt(baseDefinitions.length, buf); VarintUtils.writeUnsignedInt(orderedSfcIndexToTierId.size(), buf); VarintUtils.writeUnsignedLong(maxEstimatedDuplicateIdsPerDimension, buf); for (final byte[] sfcBinary : orderedSfcBinaries) {
/** Convert Tiered Index Metadata statistics to a JSON object */ @Override public JSONObject toJSONObject() throws JSONException { final JSONObject jo = new JSONObject(); jo.put("type", "TieredSFCIndexStrategy"); jo.put("TierCountsSize", tierCounts.length); if (null == orderedTierIdToSfcIndex) { jo.put("orderedTierIdToSfcIndex", "null"); } else { jo.put("orderedTierIdToSfcIndexSize", orderedTierIdToSfcIndex.size()); } return jo; } }