Columns (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.db

## Class Columns

- java.lang.Object
- - java.util.AbstractCollection<ColumnDefinition>
  - - org.apache.cassandra.db.Columns

- All Implemented Interfaces:
    java.lang.Iterable<ColumnDefinition>, java.util.Collection<ColumnDefinition>

      public class Columns
      extends java.util.AbstractCollection<ColumnDefinition>
      implements java.util.Collection<ColumnDefinition>

  An immutable and sorted list of (non-PK) columns for a given table.

  Note that in practice, it will either store only static columns, or only regular ones. When we need both type of columns, we use a `PartitionColumns` object.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Columns.Serializer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static ColumnDefinition` | `FIRST_COMPLEX`
    `static Columns` | `NONE`
    `static Columns.Serializer` | `serializer`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `apply(java.util.function.Consumer<ColumnDefinition> function, boolean reversed)` Apply a function to each column definition in forwards or reversed order.
    `int` | `complexColumnCount()` The number of complex columns (non-frozen collections, udts, ...) in this object.
    `java.util.Iterator<ColumnDefinition>` | `complexColumns()` Iterator over the complex columns of this object.
    `int` | `complexIdx(ColumnDefinition c)` The index of the provided complex column in this object (if it contains the provided column).
    `boolean` | `contains(ColumnDefinition c)` Whether the provided column is contained by this object.
    `boolean` | `containsAll(java.util.Collection<?> other)` Whether this object is a superset of the provided other `Columns object`.
    `void` | `digest(java.security.MessageDigest digest)`
    `void` | `digest(java.security.MessageDigest digest, java.util.Set<java.nio.ByteBuffer> columnsToExclude)`
    `boolean` | `equals(java.lang.Object other)`
    `static Columns` | `from(java.util.Collection<ColumnDefinition> s)` Returns a new `Columns` object holing the same columns than the provided set.
    `ColumnDefinition` | `getComplex(int i)` Returns the ith complex column of this object.
    `ColumnDefinition` | `getSimple(int i)` Returns the ith simple column of this object.
    `boolean` | `hasComplex()` Whether this objects contains complex columns.
    `int` | `hashCode()`
    `boolean` | `hasSimple()` Whether this objects contains simple columns.
    `java.util.function.Predicate<ColumnDefinition>` | `inOrderInclusionTester()` Returns a predicate to test whether columns are included in this `Columns` object, assuming that tes tested columns are passed to the predicate in sorted order.
    `boolean` | `isEmpty()` Whether this columns is empty.
    `BTreeSearchIterator<ColumnDefinition,ColumnDefinition>` | `iterator()` Iterator over all the columns of this object.
    `Columns` | `mergeTo(Columns other)` Returns the result of merging this `Columns` object with the provided one.
    `static Columns` | `of(ColumnDefinition c)` Creates a `Columns` holding only the one column provided.
    `java.util.Iterator<ColumnDefinition>` | `selectOrderIterator()` An iterator that returns the columns of this object in "select" order (that is in global alphabetical order, where the "normal" iterator returns simple columns first and the complex second).
    `int` | `simpleColumnCount()` The number of simple columns in this object.
    `java.util.Iterator<ColumnDefinition>` | `simpleColumns()` Iterator over the simple columns of this object.
    `int` | `simpleIdx(ColumnDefinition c)` The index of the provided simple column in this object (if it contains the provided column).
    `int` | `size()` The total number of columns in this object.
    `java.lang.String` | `toString()`
    `Columns` | `without(ColumnDefinition column)` Returns the equivalent of those columns but with the provided column removed.

    - ### Methods inherited from class java.util.AbstractCollection

      `add, addAll, clear, contains, remove, removeAll, retainAll, toArray, toArray`

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

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

    - ### Methods inherited from interface java.util.Collection

      `add, addAll, clear, contains, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### Field Detail

    - #### serializer

          public static final Columns.Serializer serializer

    - #### NONE

          public static final Columns NONE

    - #### FIRST_COMPLEX

          public static final ColumnDefinition FIRST_COMPLEX

  - ### Method Detail

    - #### of

          public static Columns of(ColumnDefinition c)

      Creates a `Columns` holding only the one column provided.
      Parameters:
        `c` - the column for which to create a `Columns` object.
      Returns:
        the newly created `Columns` containing only `c`.

    - #### from

          public static Columns from(java.util.Collection<ColumnDefinition> s)

      Returns a new `Columns` object holing the same columns than the provided set.
      Parameters:
        `s` - the set from which to create the new `Columns`.
      Returns:
        the newly created `Columns` containing the columns from `s`.

    - #### isEmpty

          public boolean isEmpty()

      Whether this columns is empty.
      Specified by:
        `isEmpty` in interface `java.util.Collection<ColumnDefinition>`
      Overrides:
        `isEmpty` in class `java.util.AbstractCollection<ColumnDefinition>`
      Returns:
        whether this columns is empty.

    - #### simpleColumnCount

          public int simpleColumnCount()

      The number of simple columns in this object.
      Returns:
        the number of simple columns in this object.

    - #### complexColumnCount

          public int complexColumnCount()

      The number of complex columns (non-frozen collections, udts, ...) in this object.
      Returns:
        the number of complex columns in this object.

    - #### size

          public int size()

      The total number of columns in this object.
      Specified by:
        `size` in interface `java.util.Collection<ColumnDefinition>`
      Specified by:
        `size` in class `java.util.AbstractCollection<ColumnDefinition>`
      Returns:
        the total number of columns in this object.

    - #### hasSimple

          public boolean hasSimple()

      Whether this objects contains simple columns.
      Returns:
        whether this objects contains simple columns.

    - #### hasComplex

          public boolean hasComplex()

      Whether this objects contains complex columns.
      Returns:
        whether this objects contains complex columns.

    - #### getSimple

          public ColumnDefinition getSimple(int i)

      Returns the ith simple column of this object.
      Parameters:
        `i` - the index for the simple column to fectch. This must satisfy `0 <= i < simpleColumnCount()`.
      Returns:
        the `i`th simple column in this object.

    - #### getComplex

          public ColumnDefinition getComplex(int i)

      Returns the ith complex column of this object.
      Parameters:
        `i` - the index for the complex column to fectch. This must satisfy `0 <= i < complexColumnCount()`.
      Returns:
        the `i`th complex column in this object.

    - #### simpleIdx

          public int simpleIdx(ColumnDefinition c)

      The index of the provided simple column in this object (if it contains the provided column).
      Parameters:
        `c` - the simple column for which to return the index of.
      Returns:
        the index for simple column `c` if it is contains in this object

    - #### complexIdx

          public int complexIdx(ColumnDefinition c)

      The index of the provided complex column in this object (if it contains the provided column).
      Parameters:
        `c` - the complex column for which to return the index of.
      Returns:
        the index for complex column `c` if it is contains in this object

    - #### contains

          public boolean contains(ColumnDefinition c)

      Whether the provided column is contained by this object.
      Parameters:
        `c` - the column to check presence of.
      Returns:
        whether `c` is contained by this object.

    - #### mergeTo

          public Columns mergeTo(Columns other)

      Returns the result of merging this `Columns` object with the provided one.
      Parameters:
        `other` - the other `Columns` to merge this object with.
      Returns:
        the result of merging/taking the union of `this` and `other`. The returned object may be one of the operand and that operand is a subset of the other operand.

    - #### containsAll

          public boolean containsAll(java.util.Collection<?> other)

      Whether this object is a superset of the provided other `Columns object`.
      Specified by:
        `containsAll` in interface `java.util.Collection<ColumnDefinition>`
      Overrides:
        `containsAll` in class `java.util.AbstractCollection<ColumnDefinition>`
      Parameters:
        `other` - the other object to test for inclusion in this object.
      Returns:
        whether all the columns of `other` are contained by this object.

    - #### simpleColumns

          public java.util.Iterator<ColumnDefinition> simpleColumns()

      Iterator over the simple columns of this object.
      Returns:
        an iterator over the simple columns of this object.

    - #### complexColumns

          public java.util.Iterator<ColumnDefinition> complexColumns()

      Iterator over the complex columns of this object.
      Returns:
        an iterator over the complex columns of this object.

    - #### iterator

          public BTreeSearchIterator<ColumnDefinition,ColumnDefinition> iterator()

      Iterator over all the columns of this object.
      Specified by:
        `iterator` in interface `java.lang.Iterable<ColumnDefinition>`
      Specified by:
        `iterator` in interface `java.util.Collection<ColumnDefinition>`
      Specified by:
        `iterator` in class `java.util.AbstractCollection<ColumnDefinition>`
      Returns:
        an iterator over all the columns of this object.

    - #### selectOrderIterator

          public java.util.Iterator<ColumnDefinition> selectOrderIterator()

      An iterator that returns the columns of this object in "select" order (that is in global alphabetical order, where the "normal" iterator returns simple columns first and the complex second).
      Returns:
        an iterator returning columns in alphabetical order.

    - #### without

          public Columns without(ColumnDefinition column)

      Returns the equivalent of those columns but with the provided column removed.
      Parameters:
        `column` - the column to remove.
      Returns:
        newly allocated columns containing all the columns of `this` expect for `column`.

    - #### inOrderInclusionTester

          public java.util.function.Predicate<ColumnDefinition> inOrderInclusionTester()

      Returns a predicate to test whether columns are included in this `Columns` object, assuming that tes tested columns are passed to the predicate in sorted order.
      Returns:
        a predicate to test the inclusion of sorted columns in this object.

    - #### digest

          public void digest(java.security.MessageDigest digest)

    - #### digest

          public void digest(java.security.MessageDigest digest,
                             java.util.Set<java.nio.ByteBuffer> columnsToExclude)

    - #### apply

          public void apply(java.util.function.Consumer<ColumnDefinition> function,
                            boolean reversed)

      Apply a function to each column definition in forwards or reversed order.
      Parameters:
        `function` -
        `reversed` -

    - #### equals

          public boolean equals(java.lang.Object other)

      Specified by:
        `equals` in interface `java.util.Collection<ColumnDefinition>`
      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Specified by:
        `hashCode` in interface `java.util.Collection<ColumnDefinition>`
      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.util.AbstractCollection<ColumnDefinition>`

Copyright © 2018 The Apache Software Foundation