protected static CompoundCType makeCType(CompoundCType clusteringType, AbstractType<?> columnNameType, ColumnToCollectionType collectionType) { List<AbstractType<?>> allSubtypes = new ArrayList<AbstractType<?>>(clusteringType.size() + (collectionType == null ? 1 : 2)); for (int i = 0; i < clusteringType.size(); i++) allSubtypes.add(clusteringType.subtype(i)); allSubtypes.add(columnNameType); if (collectionType != null) allSubtypes.add(collectionType); return new CompoundCType(allSubtypes); }
public CBuilder prefixBuilder() { return clusteringType.builder(); }
public CompoundCType(List<AbstractType<?>> types) { super(isByteOrderComparable(types)); this.types = types; }
public Composite fromByteBuffer(ByteBuffer bytes) { if (!bytes.hasRemaining()) return Composites.EMPTY; ByteBuffer[] elements = new ByteBuffer[size()]; int idx = bytes.position(), i = 0; byte eoc = 0; boolean isStatic = false; if (CompositeType.isStaticName(bytes)) { isStatic = true; idx += 2; } while (idx < bytes.limit()) { checkRemaining(bytes, idx, 2); int length = bytes.getShort(idx) & 0xFFFF; idx += 2; checkRemaining(bytes, idx, length + 1); elements[i++] = sliceBytes(bytes, idx, length); idx += length; eoc = bytes.get(idx++); } return new CompoundComposite(elements, i, isStatic).withEOC(Composite.EOC.from(eoc)); }
@Override public CellNameType setSubtype(int position, AbstractType<?> newType) { if (position < clusteringSize) return new WithCollection(clusteringType.setSubtype(position, newType), collectionType, internedIds); throw position >= fullType.size() ? new IndexOutOfBoundsException() : new IllegalArgumentException(); }
public CompoundDenseCellNameType(List<AbstractType<?>> types) { this(new CompoundCType(types)); }
public AbstractType<?> subtype(int i) { return fullType.subtype(i); }
public CellNameType setSubtype(int position, AbstractType<?> newType) { if (position < clusteringSize) return new CompoundSparseCellNameType(clusteringType.setSubtype(position, newType), columnNameType, fullType.setSubtype(position, newType), internedIds); if (position == clusteringSize) throw new IllegalArgumentException(); throw new IndexOutOfBoundsException(); }
public WithCollection(List<AbstractType<?>> types, ColumnToCollectionType collectionType) { this(new CompoundCType(types), collectionType); }
private CompoundSparseCellNameType(CompoundCType clusteringType, AbstractType<?> columnNameType, CompoundCType fullType, Map<ByteBuffer, ColumnIdentifier> internedIds) { super(clusteringType, fullType); this.columnNameType = columnNameType; this.internedIds = internedIds; this.staticPrefix = makeStaticPrefix(clusteringType.size()); }
public CompoundSparseCellNameType(List<AbstractType<?>> types, AbstractType<?> columnNameType) { this(new CompoundCType(types), columnNameType); }
public CompoundCType setSubtype(int position, AbstractType<?> newType) { List<AbstractType<?>> newTypes = new ArrayList<AbstractType<?>>(types); newTypes.set(position, newType); return new CompoundCType(newTypes); }
public CType getKeyValidatorAsCType() { return keyValidator instanceof CompositeType ? new CompoundCType(((CompositeType) keyValidator).types) : new SimpleCType(keyValidator); }