private static ByteBuffer min(ByteBuffer b1, ByteBuffer b2, AbstractType<?> comparator) { if (b1 == null) return b2; if (b2 == null) return b1; if (comparator.compare(b1, b2) >= 0) return b2; return b1; }
private static ByteBuffer max(ByteBuffer b1, ByteBuffer b2, AbstractType<?> comparator) { if (b1 == null) return b2; if (b2 == null) return b1; if (comparator.compare(b1, b2) >= 0) return b1; return b2; }
public int compareTo(Term o) { return comparator.compare(term, o.term); } }
/** * Same as compare except that this ignore ReversedType. This is to be use when * comparing 2 values to decide for a CQL condition (see Operator.isSatisfiedBy) as * for CQL, ReversedType is simply an "hint" to the storage engine but it does not * change the meaning of queries per-se. */ public int compareForCQL(ByteBuffer v1, ByteBuffer v2) { return compare(v1, v2); }
/** * An alternative comparison function used by CollectionsType in conjunction with CompositeType. * * This comparator is only called to compare components of a CompositeType. It gets the value of the * previous component as argument (or null if it's the first component of the composite). * * Unless you're doing something very similar to CollectionsType, you shouldn't override this. */ public int compareCollectionMembers(ByteBuffer v1, ByteBuffer v2, ByteBuffer collectionName) { return compare(v1, v2); }
public int compareTo(Key o) { return comparator.compare(key, o.key); } }
@Override public int compareForCQL(ByteBuffer v1, ByteBuffer v2) { return baseType.compare(v1, v2); }
private static ByteBuffer min(ByteBuffer b1, ByteBuffer b2, AbstractType<?> comparator) { if (b1 == null) return b2; if (b2 == null) return b1; if (comparator.compare(b1, b2) >= 0) return b2; return b1; }
private static ByteBuffer max(ByteBuffer b1, ByteBuffer b2, AbstractType<?> comparator) { if (b1 == null) return b2; if (b2 == null) return b1; if (comparator.compare(b1, b2) >= 0) return b1; return b2; }
/** * Same as compare except that this ignore ReversedType. This is to be use when * comparing 2 values to decide for a CQL condition (see Operator.isSatisfiedBy) as * for CQL, ReversedType is simply an "hint" to the storage engine but it does not * change the meaning of queries per-se. */ public int compareForCQL(ByteBuffer v1, ByteBuffer v2) { return compare(v1, v2); }
public int compareComponent(int i, ByteBuffer v1, ByteBuffer v2) { if (v1 == null) return v2 == null ? 0 : -1; if (v2 == null) return 1; return clusteringTypes.get(i).compare(v1, v2); }
public boolean equals(UserType userType, Value v) { if (elements.length != v.elements.length) return false; for (int i = 0; i < elements.length; i++) if (userType.fieldType(i).compare(elements[i], v.elements[i]) != 0) return false; return true; }
public boolean equals(UserType userType, Value v) { if (elements.length != v.elements.length) return false; for (int i = 0; i < elements.length; i++) if (userType.fieldType(i).compare(elements[i], v.elements[i]) != 0) return false; return true; }
public boolean equals(ListType lt, Value v) { if (elements.size() != v.elements.size()) return false; for (int i = 0; i < elements.size(); i++) if (lt.getElementsType().compare(elements.get(i), v.elements.get(i)) != 0) return false; return true; }
public boolean equals(ListType lt, Value v) { if (elements.size() != v.elements.size()) return false; for (int i = 0; i < elements.size(); i++) if (lt.getElementsType().compare(elements.get(i), v.elements.get(i)) != 0) return false; return true; }
public boolean equals(UserType userType, Value v) { if (elements.length != v.elements.length) return false; for (int i = 0; i < elements.length; i++) if (userType.fieldType(i).compare(elements[i], v.elements[i]) != 0) return false; return true; }
public int compareCollectionMembers(ByteBuffer o1, ByteBuffer o2, ByteBuffer collectionName) { CollectionType t = defined.get(collectionName); if (t == null) throw new RuntimeException(ByteBufferUtil.bytesToHex(collectionName) + " is not defined as a collection"); return t.nameComparator().compare(o1, o2); }
public int compareCollectionMembers(ByteBuffer o1, ByteBuffer o2, ByteBuffer collectionName) { CollectionType t = defined.get(collectionName); if (t == null) throw new RuntimeException(ByteBufferUtil.bytesToHex(collectionName) + " is not defined as a collection"); return t.nameComparator().compare(o1, o2); }
public boolean isStale(Row row, ByteBuffer indexValue, int nowInSec) { if (row == null) return true; Cell cell = row.getCell(indexedColumn); return (cell == null || !cell.isLive(nowInSec) || indexedColumn.type.compare(indexValue, cell.value()) != 0); } }