本文整理汇总了Java中org.apache.cassandra.utils.btree.BTreeSet.empty方法的典型用法代码示例。如果您正苦于以下问题:Java BTreeSet.empty方法的具体用法?Java BTreeSet.empty怎么用?Java BTreeSet.empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.utils.btree.BTreeSet
的用法示例。
在下文中一共展示了BTreeSet.empty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例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();
}
示例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();
}
示例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();
}
示例5: 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);
}
示例6: 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);
}
示例7: 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();
}
示例8: 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();
}