## org.apache.cassandra.db
Class ArrayBackedSortedColumns

    java.lang.Object
      org.apache.cassandra.db.AbstractThreadUnsafeSortedColumns
          org.apache.cassandra.db.ArrayBackedSortedColumns

All Implemented Interfaces:
  java.lang.Iterable<IColumn>, ISortedColumns, IIterableColumns

    public class ArrayBackedSortedColumns

extends AbstractThreadUnsafeSortedColumns
implements ISortedColumns

A ISortedColumns backed by an ArrayList. This implementation is not synchronized and should only be used when thread-safety is not required. This implementation makes sense when the main operations performed are iterating over the map and adding columns (especially if insertion is in sorted order).

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.cassandra.db.ISortedColumns
`ISortedColumns.DeletionInfo, ISortedColumns.Factory`

Field Summary
`static ISortedColumns.Factory` `factory`

Method Summary
`void` `addAll(ISortedColumns cm, Allocator allocator, com.google.common.base.Function<IColumn,IColumn> transformation)` Adds the columns without necessarily computing the size delta
`void` `addColumn(IColumn column, Allocator allocator)` AddColumn throws an exception if the column added does not sort after the last column in the map.
`void` `clear()` Clear this column map, removing all columns.
`ISortedColumns` `cloneMe()` Shallow cloning of the column map.
`static ISortedColumns.Factory` `factory()`
`IColumn` `getColumn(java.nio.ByteBuffer name)` Get a column given its name, returning null if the column is not present.
`java.util.SortedSet<java.nio.ByteBuffer>` `getColumnNames()` Returns a set with the names of columns in this column map.
`AbstractType<?>` `getComparator()`
`ISortedColumns.Factory` `getFactory()` Returns the factory used for this ISortedColumns implementation.
`java.util.Collection<IColumn>` `getReverseSortedColumns()` Returns the columns of this column map as a collection.
`java.util.Collection<IColumn>` `getSortedColumns()` Returns the columns of this column map as a collection.
`boolean` `isInsertReversed()` Returns if this map only support inserts in reverse order.
`java.util.Iterator<IColumn>` `iterator()`
`java.util.Iterator<IColumn>` `iterator(java.nio.ByteBuffer start)` Returns an iterator over the columns of this map starting from the first column whose name is equal or greater than @param start.
`void` `removeColumn(java.nio.ByteBuffer name)` Remove if present a column by name.
`boolean` `replace(IColumn oldColumn, IColumn newColumn)` Replace oldColumn if present by newColumn.
`java.util.Iterator<IColumn>` `reverseIterator()` Returns an iterator that iterates over the columns of this map in reverse order.
`java.util.Iterator<IColumn>` `reverseIterator(java.nio.ByteBuffer start)` Returns a reversed iterator over the columns of this map starting from the last column whose name is equal or lesser than @param start.
`int` `size()` Returns the number of columns in this map.

Methods inherited from class org.apache.cassandra.db.AbstractThreadUnsafeSortedColumns
`addAllWithSizeDelta, delete, getDeletionInfo, getEstimatedColumnCount, isEmpty, maybeResetDeletionTimes, retainAll`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.cassandra.db.ISortedColumns
`addAllWithSizeDelta, delete, getDeletionInfo, isEmpty, maybeResetDeletionTimes, retainAll`

Methods inherited from interface org.apache.cassandra.io.util.IIterableColumns
`getEstimatedColumnCount`

Field Detail

### factory

    public static final ISortedColumns.Factory factory

Method Detail

### factory

    public static ISortedColumns.Factory factory()

### getFactory

    public ISortedColumns.Factory getFactory()

  Description copied from interface: `ISortedColumns`
  Returns the factory used for this ISortedColumns implementation.

  Specified by:
    `getFactory` in interface `ISortedColumns`

### getComparator

    public AbstractType<?> getComparator()

  Specified by:
    `getComparator` in interface `IIterableColumns`

### cloneMe

    public ISortedColumns cloneMe()

  Description copied from interface: `ISortedColumns`
  Shallow cloning of the column map.

  Specified by:
    `cloneMe` in interface `ISortedColumns`

### isInsertReversed

    public boolean isInsertReversed()

  Description copied from interface: `ISortedColumns`
  Returns if this map only support inserts in reverse order.

  Specified by:
    `isInsertReversed` in interface `ISortedColumns`

### getColumn

    public IColumn getColumn(java.nio.ByteBuffer name)

  Description copied from interface: `ISortedColumns`
  Get a column given its name, returning null if the column is not present.

  Specified by:
    `getColumn` in interface `ISortedColumns`

### addColumn

    public void addColumn(IColumn column,
                          Allocator allocator)

  AddColumn throws an exception if the column added does not sort after the last column in the map. The reasoning is that this implementation can get slower if too much insertions are done in unsorted order and right now we only use it when *all* insertion (with this method) are done in sorted order. The assertion throwing is thus a protection against performance regression without knowing about (we can revisit that decision later if we have use cases where most insert are in sorted order but a few are not).

  Specified by:
    `addColumn` in interface `ISortedColumns`

### addAll

    public void addAll(ISortedColumns cm,
                       Allocator allocator,
                       com.google.common.base.Function<IColumn,IColumn> transformation)

  Description copied from interface: `ISortedColumns`
  Adds the columns without necessarily computing the size delta

  Specified by:
    `addAll` in interface `ISortedColumns`
  Specified by:
    `addAll` in class `AbstractThreadUnsafeSortedColumns`

### replace

    public boolean replace(IColumn oldColumn,
                           IColumn newColumn)

  Description copied from interface: `ISortedColumns`
  Replace oldColumn if present by newColumn. Returns true if oldColumn was present and thus replaced. oldColumn and newColumn should have the same name.

  Specified by:
    `replace` in interface `ISortedColumns`

### getSortedColumns

    public java.util.Collection<IColumn> getSortedColumns()

  Description copied from interface: `ISortedColumns`
  Returns the columns of this column map as a collection. The columns in the returned collection should be sorted as the columns in this map.

  Specified by:
    `getSortedColumns` in interface `ISortedColumns`

### getReverseSortedColumns

    public java.util.Collection<IColumn> getReverseSortedColumns()

  Description copied from interface: `ISortedColumns`
  Returns the columns of this column map as a collection. The columns in the returned collection should be sorted in reverse order of the columns in this map.

  Specified by:
    `getReverseSortedColumns` in interface `ISortedColumns`

### removeColumn

    public void removeColumn(java.nio.ByteBuffer name)

  Description copied from interface: `ISortedColumns`
  Remove if present a column by name.

  Specified by:
    `removeColumn` in interface `ISortedColumns`

### size

    public int size()

  Description copied from interface: `ISortedColumns`
  Returns the number of columns in this map.

  Specified by:
    `size` in interface `ISortedColumns`

### clear

    public void clear()

  Description copied from interface: `ISortedColumns`
  Clear this column map, removing all columns.

  Specified by:
    `clear` in interface `ISortedColumns`

### getColumnNames

    public java.util.SortedSet<java.nio.ByteBuffer> getColumnNames()

  Description copied from interface: `ISortedColumns`
  Returns a set with the names of columns in this column map. The resulting set is sorted and the order is the one of the columns in this column map.

  Specified by:
    `getColumnNames` in interface `ISortedColumns`

### iterator

    public java.util.Iterator<IColumn> iterator()

  Specified by:
    `iterator` in interface `java.lang.Iterable<IColumn>`

### reverseIterator

    public java.util.Iterator<IColumn> reverseIterator()

  Description copied from interface: `ISortedColumns`
  Returns an iterator that iterates over the columns of this map in reverse order.

  Specified by:
    `reverseIterator` in interface `ISortedColumns`

### iterator

    public java.util.Iterator<IColumn> iterator(java.nio.ByteBuffer start)

  Description copied from interface: `ISortedColumns`
  Returns an iterator over the columns of this map starting from the first column whose name is equal or greater than @param start.

  Specified by:
    `iterator` in interface `ISortedColumns`

### reverseIterator

    public java.util.Iterator<IColumn> reverseIterator(java.nio.ByteBuffer start)

  Description copied from interface: `ISortedColumns`
  Returns a reversed iterator over the columns of this map starting from the last column whose name is equal or lesser than @param start.

  Specified by:
    `reverseIterator` in interface `ISortedColumns`

Copyright © 2013 The Apache Software Foundation