public boolean isStatic() { return wrapped.isStatic(); }
public CellName rowMarker(Composite prefix) { assert !prefix.isStatic(); // static columns don't really create rows, they shouldn't have a row marker if (prefix.isEmpty()) return rowMarkerNoPrefix; return create(prefix, rowMarkerId, false); }
public CFRowAdder(ColumnFamily cf, Composite prefix, long timestamp) { this.cf = cf; this.prefix = prefix; this.timestamp = timestamp; this.ldt = (int) (System.currentTimeMillis() / 1000); // If a CQL3 table, add the row marker if (cf.metadata().isCQL3Table() && !prefix.isStatic()) cf.addColumn(new BufferCell(cf.getComparator().rowMarker(prefix), ByteBufferUtil.EMPTY_BYTE_BUFFER, timestamp)); }
static int compareUnsigned(Composite c1, Composite c2) { if (c1.isStatic() != c2.isStatic()) { // Static sorts before non-static no matter what, except for empty which // always sort first if (c1.isEmpty()) return c2.isEmpty() ? 0 : -1; if (c2.isEmpty()) return 1; return c1.isStatic() ? -1 : 1; } int s1 = c1.size(); int s2 = c2.size(); int minSize = Math.min(s1, s2); for (int i = 0; i < minSize; i++) { int cmp = ByteBufferUtil.compareUnsigned(c1.get(i), c2.get(i)); if (cmp != 0) return cmp; } if (s1 == s2) return c1.eoc().compareTo(c2.eoc()); return s1 < s2 ? c1.eoc().prefixComparisonResult : -c2.eoc().prefixComparisonResult; }
@Override public boolean equals(Object o) { if (this == o) return true; if(!(o instanceof Composite)) return false; Composite c = (Composite)o; if (size() != c.size() || isStatic() != c.isStatic()) return false; for (int i = 0; i < size(); i++) { if (!get(i).equals(c.get(i))) return false; } return eoc() == c.eoc(); }
public int compare(Composite c1, Composite c2) { if (c1.isStatic() != c2.isStatic()) { // Static sorts before non-static no matter what, except for empty which // always sort first if (c1.isEmpty()) return c2.isEmpty() ? 0 : -1; if (c2.isEmpty()) return 1; return c1.isStatic() ? -1 : 1; } int s1 = c1.size(); int s2 = c2.size(); int minSize = Math.min(s1, s2); for (int i = 0; i < minSize; i++) { int cmp = isByteOrderComparable ? ByteBufferUtil.compareUnsigned(c1.get(i), c2.get(i)) : subtype(i).compare(c1.get(i), c2.get(i)); if (cmp != 0) return cmp; } if (s1 == s2) return c1.eoc().compareTo(c2.eoc()); return s1 < s2 ? c1.eoc().prefixComparisonResult : -c2.eoc().prefixComparisonResult; }
public boolean isPrefixOf(CType type, Composite c) { if (size() > c.size() || isStatic() != c.isStatic()) return false; for (int i = 0; i < size(); i++) { if (type.subtype(i).compare(get(i), c.get(i)) != 0) return false; } return true; }
public boolean isPrefixOf(CType type, Composite c) { if (size() > c.size() || isStatic() != c.isStatic()) return false; for (int i = 0; i < size(); i++) { if (type.subtype(i).compare(get(i), c.get(i)) != 0) return false; } return true; }
if (type == StatementType.INSERT && cfm.isCQL3Table() && !prefix.isStatic()) cf.addColumn(params.makeColumn(cfm.comparator.rowMarker(prefix), ByteBufferUtil.EMPTY_BYTE_BUFFER));
@Inline public final int compareTo(final Composite that) if (isStatic() != that.isStatic())
return -1; if (nextIsStatic != composite.isStatic()) return nextIsStatic ? -1 : 1;