public final Composite start(CellName cellName) { CBuilder builder = clusteringCType.builder(); for (int i = 0; i < cellName.clusteringSize(); i++) { ByteBuffer component = cellName.get(i); builder.add(component); } return builder.build(); }
public boolean isSameCQL3RowAs(CellNameType type, CellName other) { if (clusteringSize() != other.clusteringSize() || other.isStatic() != isStatic()) return false; for (int i = 0; i < clusteringSize(); i++) { if (type.subtype(i).compare(elements[i], other.get(i)) != 0) return false; } return true; }
protected void construct(Cell from) { setLong(TIMESTAMP_OFFSET, from.timestamp()); CellName name = from.name(); int nameSize = name.size(); int offset = CELL_NAME_SIZE_OFFSET; setShort(offset, (short) nameSize); assert nameSize - name.clusteringSize() <= 2; byte cellNameExtraBits = (byte) ((nameSize - name.clusteringSize()) | NameType.typeOf(name).bits); setByte(offset += 2, cellNameExtraBits); offset += 1; short cellNameDelta = 0; for (int i = 1; i < nameSize; i++) { cellNameDelta += name.get(i - 1).remaining(); setShort(offset, cellNameDelta); offset += 2; } for (int i = 0; i < nameSize; i++) { ByteBuffer bb = name.get(i); setBytes(offset, bb); offset += bb.remaining(); } setInt(VALUE_OFFSET_OFFSET, offset); setBytes(offset, from.value()); }
public boolean isSameCQL3RowAs(CellNameType type, CellName other) { switch (nametype()) { case SIMPLE_DENSE: case COMPOUND_DENSE: return type.compare(this, other) == 0; case COMPOUND_SPARSE_STATIC: case COMPOUND_SPARSE: int clusteringSize = clusteringSize(); if (clusteringSize != other.clusteringSize() || other.isStatic() != isStatic()) return false; for (int i = 0; i < clusteringSize; i++) if (type.subtype(i).compare(get(i), other.get(i)) != 0) return false; return true; case SIMPLE_SPARSE: return true; default: throw new AssertionError(); } }