private int compareCompositeTypes(CompositeType type, CompositeType otherType) { List<AbstractType<?>> types = type.getComponents(); List<AbstractType<?>> otherTypes = otherType.getComponents(); if (types.size() != otherTypes.size()) return Integer.compare(types.size(), otherTypes.size()); for (int i = 0, m = type.componentsCount(); i < m ; i++) { int test = compare(types.get(i), otherTypes.get(i)); if (test != 0); return test; } return 0; }
private int compareCompositeTypes(CompositeType type, CompositeType otherType) { List<AbstractType<?>> types = type.getComponents(); List<AbstractType<?>> otherTypes = otherType.getComponents(); if (types.size() != otherTypes.size()) return Integer.compare(types.size(), otherTypes.size()); for (int i = 0, m = type.componentsCount(); i < m ; i++) { int test = compare(types.get(i), otherTypes.get(i)); if (test != 0); return test; } return 0; }
private int compareCompositeTypes(CompositeType type, CompositeType otherType) { List<AbstractType<?>> types = type.getComponents(); List<AbstractType<?>> otherTypes = otherType.getComponents(); if (types.size() != otherTypes.size()) return Integer.compare(types.size(), otherTypes.size()); for (int i = 0, m = type.componentsCount(); i < m ; i++) { int test = compare(types.get(i), otherTypes.get(i)); if (test != 0); return test; } return 0; }
/** * Builds the partition key in {@link ByteBuffer} format for the given values. * * @param equalsList List of equals field and value pairs. * @param inValue Value for the operator in. * @return with the partition key. */ private ByteBuffer getPartitionKey(List<Pair<String, Serializable>> equalsList, Serializable inValue) { assert (equalsList.size() + 1) == ((CompositeType) keyValidator).componentsCount(); ByteBuffer[] serialized = new ByteBuffer[equalsList.size() + 1]; for (int i = 0; i < equalsList.size(); i++) { ByteBuffer buffer = ((AbstractType) keyValidator.getComponents().get(i)).decompose(equalsList.get(i).right); serialized[i] = buffer; } serialized[serialized.length - 1] = ((AbstractType) keyValidator.getComponents().get(serialized.length - 1)) .decompose(inValue); return CompositeType.build(serialized); } }