本文整理汇总了Java中org.apache.cassandra.utils.btree.BTreeSet类的典型用法代码示例。如果您正苦于以下问题:Java BTreeSet类的具体用法?Java BTreeSet怎么用?Java BTreeSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BTreeSet类属于org.apache.cassandra.utils.btree包,在下文中一共展示了BTreeSet类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildBound
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
public NavigableSet<ClusteringBound> buildBound(boolean isStart, boolean isInclusive)
{
built = true;
if (hasMissingElements)
return BTreeSet.empty(comparator);
if (size == 0)
return BTreeSet.of(comparator, isStart ? ClusteringBound.BOTTOM : ClusteringBound.TOP);
ByteBuffer[] newValues = size == elements.length
? elements
: Arrays.copyOf(elements, size);
return BTreeSet.of(comparator, ClusteringBound.create(ClusteringBound.boundKind(isStart, isInclusive), newValues));
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:17,代码来源:MultiCBuilder.java
示例2: build
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
public NavigableSet<Clustering> build()
{
built = true;
if (hasMissingElements)
return BTreeSet.empty(comparator);
CBuilder builder = CBuilder.create(comparator);
if (elementsList.isEmpty())
return BTreeSet.of(builder.comparator(), builder.build());
BTreeSet.Builder<Clustering> set = BTreeSet.builder(builder.comparator());
for (int i = 0, m = elementsList.size(); i < m; i++)
{
List<ByteBuffer> elements = elementsList.get(i);
set.add(builder.buildWith(elements));
}
return set.build();
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:21,代码来源:MultiCBuilder.java
示例3: build
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
/**
* Builds the <code>clusterings</code>.
*
* @return the clusterings
*/
public NavigableSet<Clustering> build()
{
built = true;
if (hasMissingElements)
return BTreeSet.empty(comparator);
CBuilder builder = CBuilder.create(comparator);
if (elementsList.isEmpty())
return BTreeSet.of(builder.comparator(), builder.build());
BTreeSet.Builder<Clustering> set = BTreeSet.builder(builder.comparator());
for (int i = 0, m = elementsList.size(); i < m; i++)
{
List<ByteBuffer> elements = elementsList.get(i);
set.add(builder.buildWith(elements));
}
return set.build();
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:26,代码来源:MultiCBuilder.java
示例4: buildBound
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
public NavigableSet<Slice.Bound> buildBound(boolean isStart, boolean isInclusive)
{
built = true;
if (hasMissingElements)
return BTreeSet.empty(comparator);
CBuilder builder = CBuilder.create(comparator);
if (elementsList.isEmpty())
return BTreeSet.of(comparator, builder.buildBound(isStart, isInclusive));
// Use a TreeSet to sort and eliminate duplicates
BTreeSet.Builder<Slice.Bound> set = BTreeSet.builder(comparator);
for (int i = 0, m = elementsList.size(); i < m; i++)
{
List<ByteBuffer> elements = elementsList.get(i);
set.add(builder.buildBoundWith(elements, isStart, isInclusive));
}
return set.build();
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:23,代码来源:MultiCBuilder.java
示例5: deserialize
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
public ClusteringIndexFilter deserialize(DataInputPlus in, int version, CFMetaData metadata, boolean reversed) throws IOException
{
ClusteringComparator comparator = metadata.comparator;
BTreeSet.Builder<Clustering> clusterings = BTreeSet.builder(comparator);
int size = (int)in.readUnsignedVInt();
for (int i = 0; i < size; i++)
clusterings.add(Clustering.serializer.deserialize(in, version, comparator.subtypes()));
return new ClusteringIndexNamesFilter(clusterings.build(), reversed);
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:11,代码来源:ClusteringIndexNamesFilter.java
示例6: testAllSlices
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
private static List<ListenableFuture<?>> testAllSlices(String id, Object[] btree, NavigableSet<Integer> canon)
{
List<ListenableFuture<?>> waitFor = new ArrayList<>();
testAllSlices(id + " ASC", new BTreeSet<>(btree, ICMP), canon, true, waitFor);
testAllSlices(id + " DSC", new BTreeSet<>(btree, ICMP).descendingSet(), canon.descendingSet(), false, waitFor);
return waitFor;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:LongBTreeTest.java
示例7: boundsAsClustering
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
@Override
public NavigableSet<Slice.Bound> boundsAsClustering(Bound bound, QueryOptions options) throws InvalidRequestException
{
MultiCBuilder builder = MultiCBuilder.create(comparator);
int keyPosition = 0;
for (Restriction r : restrictions)
{
ColumnDefinition def = r.getFirstColumn();
if (keyPosition != def.position() || r.isContains())
break;
if (r.isSlice())
{
r.appendBoundTo(builder, bound, options);
return builder.buildBoundForSlice(bound.isStart(),
r.isInclusive(bound),
r.isInclusive(bound.reverse()),
r.getColumnDefs());
}
r.appendBoundTo(builder, bound, options);
if (builder.hasMissingElements())
return BTreeSet.empty(comparator);
keyPosition = r.getLastColumn().position() + 1;
}
// Everything was an equal (or there was nothing)
return builder.buildBound(bound.isStart(), true);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:33,代码来源:PrimaryKeyRestrictionSet.java
示例8: getClusteringColumns
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
/**
* Returns the requested clustering columns.
*
* @param options the query options
* @return the requested clustering columns
*/
public NavigableSet<Clustering> getClusteringColumns(QueryOptions options)
{
// If this is a names command and the table is a static compact one, then as far as CQL is concerned we have
// only a single row which internally correspond to the static parts. In which case we want to return an empty
// set (since that's what ClusteringIndexNamesFilter expects).
if (cfm.isStaticCompactTable())
return BTreeSet.empty(cfm.comparator);
return clusteringColumnsRestrictions.valuesAsClustering(options);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:17,代码来源:StatementRestrictions.java
示例9: updateWithCurrentValuesFromCFS
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
private void updateWithCurrentValuesFromCFS(List<PartitionUpdate.CounterMark> marks, ColumnFamilyStore cfs)
{
ColumnFilter.Builder builder = ColumnFilter.selectionBuilder();
BTreeSet.Builder<Clustering> names = BTreeSet.builder(cfs.metadata.comparator);
for (PartitionUpdate.CounterMark mark : marks)
{
if (mark.clustering() != Clustering.STATIC_CLUSTERING)
names.add(mark.clustering());
if (mark.path() == null)
builder.add(mark.column());
else
builder.select(mark.column(), mark.path());
}
int nowInSec = FBUtilities.nowInSeconds();
ClusteringIndexNamesFilter filter = new ClusteringIndexNamesFilter(names.build(), false);
SinglePartitionReadCommand cmd = SinglePartitionReadCommand.create(cfs.metadata, nowInSec, key(), builder.build(), filter);
PeekingIterator<PartitionUpdate.CounterMark> markIter = Iterators.peekingIterator(marks.iterator());
try (OpOrder.Group op = cfs.readOrdering.start(); RowIterator partition = UnfilteredRowIterators.filter(cmd.queryMemtableAndDisk(cfs, op), nowInSec))
{
updateForRow(markIter, partition.staticRow(), cfs);
while (partition.hasNext())
{
if (!markIter.hasNext())
return;
updateForRow(markIter, partition.next(), cfs);
}
}
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:32,代码来源:CounterMutation.java
示例10: randomSelection
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
private static Iterable<Integer> randomSelection(Object[] iter, final Random rnd)
{
final float proportion = rnd.nextFloat();
return Iterables.filter(new BTreeSet<>(iter, ICMP), new Predicate<Integer>()
{
public boolean apply(Integer integer)
{
return rnd.nextFloat() < proportion;
}
});
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:12,代码来源:LongBTreeTest.java
示例11: randomMix
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
private static Iterable<Integer> randomMix(Object[] iter, final Random rnd)
{
final float proportion = rnd.nextFloat();
return Iterables.transform(new BTreeSet<>(iter, ICMP), new Function<Integer, Integer>()
{
int last = Integer.MIN_VALUE;
public Integer apply(Integer v)
{
if (rnd.nextFloat() < proportion)
return last = v;
return last = (v - last) / 2;
}
});
}
开发者ID:daidong,项目名称:GraphTrek,代码行数:16,代码来源:LongBTreeTest.java
示例12: buildBoundForSlice
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
public NavigableSet<ClusteringBound> buildBoundForSlice(boolean isStart,
boolean isInclusive,
boolean isOtherBoundInclusive,
List<ColumnDefinition> columnDefs)
{
built = true;
if (hasMissingElements)
return BTreeSet.empty(comparator);
CBuilder builder = CBuilder.create(comparator);
if (elementsList.isEmpty())
return BTreeSet.of(comparator, builder.buildBound(isStart, isInclusive));
// Use a TreeSet to sort and eliminate duplicates
BTreeSet.Builder<ClusteringBound> set = BTreeSet.builder(comparator);
// The first column of the slice might not be the first clustering column (e.g. clustering_0 = ? AND (clustering_1, clustering_2) >= (?, ?)
int offset = columnDefs.get(0).position();
for (int i = 0, m = elementsList.size(); i < m; i++)
{
List<ByteBuffer> elements = elementsList.get(i);
// Handle the no bound case
if (elements.size() == offset)
{
set.add(builder.buildBoundWith(elements, isStart, true));
continue;
}
// In the case of mixed order columns, we will have some extra slices where the columns change directions.
// For example: if we have clustering_0 DESC and clustering_1 ASC a slice like (clustering_0, clustering_1) > (1, 2)
// will produce 2 slices: [BOTTOM, 1) and (1.2, 1]
// So, the END bound will return 2 bounds with the same values 1
ColumnDefinition lastColumn = columnDefs.get(columnDefs.size() - 1);
if (elements.size() <= lastColumn.position() && i < m - 1 && elements.equals(elementsList.get(i + 1)))
{
set.add(builder.buildBoundWith(elements, isStart, false));
set.add(builder.buildBoundWith(elementsList.get(i++), isStart, true));
continue;
}
// Handle the normal bounds
ColumnDefinition column = columnDefs.get(elements.size() - 1 - offset);
set.add(builder.buildBoundWith(elements, isStart, column.isReversedType() ? isOtherBoundInclusive : isInclusive));
}
return set.build();
}
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:51,代码来源:MultiCBuilder.java
示例13: buildBoundForSlice
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
/**
* Builds the <code>Slice.Bound</code>s for slice restrictions.
*
* @param isStart specify if the bound is a start one
* @param isInclusive specify if the bound is inclusive or not
* @param isOtherBoundInclusive specify if the other bound is inclusive or not
* @param columnDefs the columns of the slice restriction
* @return the <code>Slice.Bound</code>s
*/
public NavigableSet<Slice.Bound> buildBoundForSlice(boolean isStart,
boolean isInclusive,
boolean isOtherBoundInclusive,
List<ColumnDefinition> columnDefs)
{
built = true;
if (hasMissingElements)
return BTreeSet.empty(comparator);
CBuilder builder = CBuilder.create(comparator);
if (elementsList.isEmpty())
return BTreeSet.of(comparator, builder.buildBound(isStart, isInclusive));
// Use a TreeSet to sort and eliminate duplicates
BTreeSet.Builder<Slice.Bound> set = BTreeSet.builder(comparator);
// The first column of the slice might not be the first clustering column (e.g. clustering_0 = ? AND (clustering_1, clustering_2) >= (?, ?)
int offset = columnDefs.get(0).position();
for (int i = 0, m = elementsList.size(); i < m; i++)
{
List<ByteBuffer> elements = elementsList.get(i);
// Handle the no bound case
if (elements.size() == offset)
{
set.add(builder.buildBoundWith(elements, isStart, true));
continue;
}
// In the case of mixed order columns, we will have some extra slices where the columns change directions.
// For example: if we have clustering_0 DESC and clustering_1 ASC a slice like (clustering_0, clustering_1) > (1, 2)
// will produce 2 slices: [BOTTOM, 1) and (1.2, 1]
// So, the END bound will return 2 bounds with the same values 1
ColumnDefinition lastColumn = columnDefs.get(columnDefs.size() - 1);
if (elements.size() <= lastColumn.position() && i < m - 1 && elements.equals(elementsList.get(i + 1)))
{
set.add(builder.buildBoundWith(elements, isStart, false));
set.add(builder.buildBoundWith(elementsList.get(i++), isStart, true));
continue;
}
// Handle the normal bounds
ColumnDefinition column = columnDefs.get(elements.size() - 1 - offset);
set.add(builder.buildBoundWith(elements, isStart, column.isReversedType() ? isOtherBoundInclusive : isInclusive));
}
return set.build();
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:60,代码来源:MultiCBuilder.java
示例14: reduceFilter
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
private ClusteringIndexNamesFilter reduceFilter(ClusteringIndexNamesFilter filter, Partition result, long sstableTimestamp)
{
if (result == null)
return filter;
SearchIterator<Clustering, Row> searchIter = result.searchIterator(columnFilter(), false);
PartitionColumns columns = columnFilter().fetchedColumns();
NavigableSet<Clustering> clusterings = filter.requestedRows();
// We want to remove rows for which we have values for all requested columns. We have to deal with both static and regular rows.
// TODO: we could also remove a selected column if we've found values for every requested row but we'll leave
// that for later.
boolean removeStatic = false;
if (!columns.statics.isEmpty())
{
Row staticRow = searchIter.next(Clustering.STATIC_CLUSTERING);
removeStatic = staticRow != null && canRemoveRow(staticRow, columns.statics, sstableTimestamp);
}
NavigableSet<Clustering> toRemove = null;
for (Clustering clustering : clusterings)
{
if (!searchIter.hasNext())
break;
Row row = searchIter.next(clustering);
if (row == null || !canRemoveRow(row, columns.regulars, sstableTimestamp))
continue;
if (toRemove == null)
toRemove = new TreeSet<>(result.metadata().comparator);
toRemove.add(clustering);
}
if (!removeStatic && toRemove == null)
return filter;
// Check if we have everything we need
boolean hasNoMoreStatic = columns.statics.isEmpty() || removeStatic;
boolean hasNoMoreClusterings = clusterings.isEmpty() || (toRemove != null && toRemove.size() == clusterings.size());
if (hasNoMoreStatic && hasNoMoreClusterings)
return null;
if (toRemove != null)
{
BTreeSet.Builder<Clustering> newClusterings = BTreeSet.builder(result.metadata().comparator);
newClusterings.addAll(Sets.difference(clusterings, toRemove));
clusterings = newClusterings.build();
}
return new ClusteringIndexNamesFilter(clusterings, filter.isReversed());
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:54,代码来源:SinglePartitionReadCommand.java
示例15: ColumnsCheck
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
private ColumnsCheck(List<ColumnDefinition> definitions)
{
this.columns = Columns.from(BTreeSet.of(definitions));
this.definitions = definitions;
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:6,代码来源:ColumnsTest.java
示例16: iterator
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
public Iterator<Cell> iterator(ColumnSlice[] slices)
{
return new ColumnSlice.NavigableSetIterator(new BTreeSet<>(ref.tree, getComparator().columnComparator()), slices);
}
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:5,代码来源:AtomicBTreeColumns.java
示例17: reverseIterator
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
public Iterator<Cell> reverseIterator(ColumnSlice[] slices)
{
return new ColumnSlice.NavigableSetIterator(new BTreeSet<>(ref.tree, getComparator().columnComparator()).descendingSet(), slices);
}
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:5,代码来源:AtomicBTreeColumns.java
示例18: cellRange
import org.apache.cassandra.utils.btree.BTreeSet; //导入依赖的package包/类
private Iterator<Cell> cellRange(Comparator<Cell> comparator, Composite start, Composite finish)
{
return new ColumnSlice.NavigableSetIterator(new BTreeSet<>(tree, comparator), new ColumnSlice[]{ new ColumnSlice(start, finish) });
}
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:5,代码来源:AtomicBTreeColumns.java
注:本文中的org.apache.cassandra.utils.btree.BTreeSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论