org.apache.cassandra.db

## Class ArrayBackedSortedColumns

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

All Implemented Interfaces:
  java.lang.Iterable<Column>, IRowCacheEntry

    public class ArrayBackedSortedColumns
    extends AbstractThreadUnsafeSortedColumns

A ColumnFamily 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 class org.apache.cassandra.db.ColumnFamily

`ColumnFamily.Factory<T extends ColumnFamily>`

### Field Summary

Fields
`static ColumnFamily.Factory<ArrayBackedSortedColumns>` `factory`

### Fields inherited from class org.apache.cassandra.db.AbstractThreadUnsafeSortedColumns

`deletionInfo`

### Fields inherited from class org.apache.cassandra.db.ColumnFamily

`metadata, serializer`

### Method Summary

Methods
`void` `addAll(ColumnFamily cm, Allocator allocator, com.google.common.base.Function<Column,Column> transformation)` Adds all the columns of a given column map to this column map.
`void` `addColumn(Column 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 family, removing all columns and deletion info.
`ColumnFamily` `cloneMe()` Clones the column map.
`Column` `getColumn(java.nio.ByteBuffer name)` Get a column given its name, returning null if the column is not present.
`int` `getColumnCount()` Returns the number of columns in this map.
`java.lang.Iterable<java.nio.ByteBuffer>` `getColumnNames()` Returns an iterable with the names of columns in this column map in the same order as the underlying columns themselves.
`ColumnFamily.Factory` `getFactory()` Returns the factory used for this ISortedColumns implementation.
`java.util.Collection<Column>` `getReverseSortedColumns()` Returns the columns of this column map as a collection.
`java.util.Collection<Column>` `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<Column>` `iterator()`
`java.util.Iterator<Column>` `iterator(ColumnSlice[] slices)` Returns an iterator over the columns of this map that returns only the matching @param slices.
`boolean` `replace(Column oldColumn, Column newColumn)` Replace oldColumn if present by newColumn.
`java.util.Iterator<Column>` `reverseIterator(ColumnSlice[] slices)` Returns a reversed iterator over the columns of this map that returns only the matching @param slices.

### Methods inherited from class org.apache.cassandra.db.AbstractThreadUnsafeSortedColumns

`delete, delete, delete, deletionInfo, purgeTombstones, setDeletionInfo`

### Methods inherited from class org.apache.cassandra.db.ColumnFamily

`addAll, addAtom, addColumn, addColumn, addColumn, addCounter, addIfRelevant, addTombstone, addTombstone, asMap, cloneMeShallow, cloneMeShallow, dataSize, delete, diff, diff, digest, equals, fromBytes, getColumnStats, getComparator, getType, hashCode, hasIrrelevantData, hasOnlyTombstones, id, inOrderDeletionTester, isEmpty, isMarkedForDelete, maxTimestamp, metadata, resolve, resolve, reverseIterator, toBytes, toString, updateDigest`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### factory

    public static final ColumnFamily.Factory<ArrayBackedSortedColumns> factory

### Method Detail

#### getFactory

    public ColumnFamily.Factory getFactory()

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

Specified by:
  `getFactory` in class `ColumnFamily`

#### cloneMe

    public ColumnFamily cloneMe()

Description copied from class: `ColumnFamily`
Clones the column map.

Specified by:
  `cloneMe` in class `ColumnFamily`

#### isInsertReversed

    public boolean isInsertReversed()

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

Specified by:
  `isInsertReversed` in class `ColumnFamily`

#### getColumn

    public Column getColumn(java.nio.ByteBuffer name)

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

Specified by:
  `getColumn` in class `ColumnFamily`

#### addColumn

    public void addColumn(Column 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 class `ColumnFamily`

#### addAll

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

Description copied from class: `ColumnFamily`
Adds all the columns of a given column map to this column map. This is equivalent to: `for (Column c : cm) addColumn(c, ...);` but is potentially faster.

Specified by:
  `addAll` in class `ColumnFamily`

#### replace

    public boolean replace(Column oldColumn,
                  Column newColumn)

Description copied from class: `ColumnFamily`
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 class `ColumnFamily`

#### getSortedColumns

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

Description copied from class: `ColumnFamily`
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 class `ColumnFamily`

#### getReverseSortedColumns

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

Description copied from class: `ColumnFamily`
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 class `ColumnFamily`

#### getColumnCount

    public int getColumnCount()

Description copied from class: `ColumnFamily`
Returns the number of columns in this map.

Specified by:
  `getColumnCount` in class `ColumnFamily`

#### clear

    public void clear()

Description copied from class: `ColumnFamily`
Clear this column family, removing all columns and deletion info.

Specified by:
  `clear` in class `ColumnFamily`

#### getColumnNames

    public java.lang.Iterable<java.nio.ByteBuffer> getColumnNames()

Description copied from class: `ColumnFamily`
Returns an iterable with the names of columns in this column map in the same order as the underlying columns themselves.

Specified by:
  `getColumnNames` in class `ColumnFamily`

#### iterator

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

Specified by:
  `iterator` in interface `java.lang.Iterable<Column>`
Overrides:
  `iterator` in class `ColumnFamily`

#### iterator

    public java.util.Iterator<Column> iterator(ColumnSlice[] slices)

Description copied from class: `ColumnFamily`
Returns an iterator over the columns of this map that returns only the matching @param slices. The provided slices must be in order and must be non-overlapping.

Specified by:
  `iterator` in class `ColumnFamily`

#### reverseIterator

    public java.util.Iterator<Column> reverseIterator(ColumnSlice[] slices)

Description copied from class: `ColumnFamily`
Returns a reversed iterator over the columns of this map that returns only the matching @param slices. The provided slices must be in reversed order and must be non-overlapping.

Specified by:
  `reverseIterator` in class `ColumnFamily`