@Override public int size() { return BTree.size(tree); }
private Columns(Object[] columns, int complexIdx) { assert complexIdx <= BTree.size(columns); this.columns = columns; this.complexIdx = complexIdx; }
/** * Whether this objects contains complex columns. * * @return whether this objects contains complex columns. */ public boolean hasComplex() { return complexIdx < BTree.size(columns); }
/** * Whether this objects contains complex columns. * * @return whether this objects contains complex columns. */ public boolean hasComplex() { return complexIdx < BTree.size(columns); }
private Columns(Object[] columns, int complexIdx) { assert complexIdx <= BTree.size(columns); this.columns = columns; this.complexIdx = complexIdx; }
/** * The number of complex columns (non-frozen collections, udts, ...) in this object. * * @return the number of complex columns in this object. */ public int complexColumnCount() { return BTree.size(columns) - complexIdx; }
/** * Fill the target array with the contents of the provided subtree, in ascending order, starting at targetOffset * @param tree source * @param target array * @param targetOffset offset in target array * @return number of items copied (size of tree) */ public static int toArray(Object[] tree, Object[] target, int targetOffset) { return toArray(tree, 0, size(tree), target, targetOffset); } public static int toArray(Object[] tree, int treeStart, int treeEnd, Object[] target, int targetOffset)
/** * Iterator over the complex columns of this object. * * @return an iterator over the complex columns of this object. */ public Iterator<ColumnDefinition> complexColumns() { return BTree.iterator(columns, complexIdx, BTree.size(columns) - 1, BTree.Dir.ASC); }
/** * Fill the target array with the contents of the provided subtree, in ascending order, starting at targetOffset * @param tree source * @param target array * @param targetOffset offset in target array * @return number of items copied (size of tree) */ public static int toArray(Object[] tree, Object[] target, int targetOffset) { return toArray(tree, 0, size(tree), target, targetOffset); } public static int toArray(Object[] tree, int treeStart, int treeEnd, Object[] target, int targetOffset)
/** * Iterator over the complex columns of this object. * * @return an iterator over the complex columns of this object. */ public Iterator<ColumnDefinition> complexColumns() { return BTree.iterator(columns, complexIdx, BTree.size(columns) - 1, BTree.Dir.ASC); }
public static <V> V higher(Object[] btree, Comparator<? super V> comparator, V find) { int i = higherIndex(btree, comparator, find); return i < size(btree) ? findByIndex(btree, i) : null; }
public static <V> V ceil(Object[] btree, Comparator<? super V> comparator, V find) { int i = ceilIndex(btree, comparator, find); return i < size(btree) ? findByIndex(btree, i) : null; }
public static <V> V higher(Object[] btree, Comparator<? super V> comparator, V find) { int i = higherIndex(btree, comparator, find); return i < size(btree) ? findByIndex(btree, i) : null; }
public Row lastRow() { Object[] tree = holder().tree; if (BTree.isEmpty(tree)) return null; return BTree.findByIndex(tree, BTree.size(tree) - 1); } }
private static int findFirstComplexIdx(Object[] tree) { // have fast path for common no-complex case int size = BTree.size(tree); if (!BTree.isEmpty(tree) && BTree.<ColumnDefinition>findByIndex(tree, size - 1).isSimple()) return size; return BTree.ceilIndex(tree, Comparator.naturalOrder(), FIRST_COMPLEX); }
public Row lastRow() { Object[] tree = holder().tree; if (BTree.isEmpty(tree)) return null; return BTree.findByIndex(tree, BTree.size(tree) - 1); } }
BTreeRange(Object[] tree, Comparator<? super V> comparator, V lowerBound, boolean inclusiveLowerBound, V upperBound, boolean inclusiveUpperBound) { this(tree, comparator, lowerBound == null ? 0 : inclusiveLowerBound ? BTree.ceilIndex(tree, comparator, lowerBound) : BTree.higherIndex(tree, comparator, lowerBound), upperBound == null ? BTree.size(tree) - 1 : inclusiveUpperBound ? BTree.floorIndex(tree, comparator, upperBound) : BTree.lowerIndex(tree, comparator, upperBound)); }
BTreeRange(Object[] tree, Comparator<? super V> comparator, V lowerBound, boolean inclusiveLowerBound, V upperBound, boolean inclusiveUpperBound) { this(tree, comparator, lowerBound == null ? 0 : inclusiveLowerBound ? BTree.ceilIndex(tree, comparator, lowerBound) : BTree.higherIndex(tree, comparator, lowerBound), upperBound == null ? BTree.size(tree) - 1 : inclusiveUpperBound ? BTree.floorIndex(tree, comparator, upperBound) : BTree.lowerIndex(tree, comparator, upperBound)); }