Package adql.db

Class SearchColumnList

All Implemented Interfaces:
Serializable, Cloneable, Iterable<DBColumn>, Collection<DBColumn>, List<DBColumn>, RandomAccess, SequencedCollection<DBColumn>

public class SearchColumnList extends cds.utils.TextualSearchList<DBColumn>
A list of DBColumn elements ordered by their ADQL name in an ascending manner.

In addition to an ADQL name, DBColumn elements can be searched by specifying their table, schema and catalog. These last information will be used only if the ADQL column name is ambiguous, otherwise all matching elements are returned.

Note: Table aliases can be listed here with their corresponding table name. Consequently, a table alias can be given as table name in the search parameters.

See Also:
  • Constructor Details

    • SearchColumnList

      public SearchColumnList()
      Void constructor.
    • SearchColumnList

      public SearchColumnList(Collection<DBColumn> collection)
      Constructor by copy: all the elements of the given collection of DBColumn are copied ordered into this list.
      Parameters:
      collection - Collection of DBColumn to copy.
    • SearchColumnList

      public SearchColumnList(int initialCapacity)
      Constructor with the initial capacity.
      Parameters:
      initialCapacity - Initial capacity of this list.
  • Method Details

    • isDistinct

      public final boolean isDistinct()
      Tells whether multiple occurrences are allowed.
      Returns:
      true means that multiple occurrences are allowed, false otherwise.
    • setDistinct

      public final void setDistinct(boolean distinct)
      Lets indicating that multiple occurrences are allowed.
      Parameters:
      distinct - true means that multiple occurrences are allowed, false otherwise.
    • putTableAlias

      public final void putTableAlias(String tableAlias, String tableName)
      Adds the given association between a table name and its alias in a query.
      Parameters:
      tableAlias - Table alias.
      tableName - Table name.
    • removeTableAlias

      public final void removeTableAlias(String tableAlias)
      Removes the given alias from this list.
      Parameters:
      tableAlias - The table alias which must be removed.
    • removeAllTableAliases

      public final void removeAllTableAliases()
      Removes all table name/alias associations.
    • getNbTableAliases

      public final int getNbTableAliases()
    • search

      public List<DBColumn> search(String columnName)
      Searches all DBColumn elements which has the given name (case insensitive).
      Parameters:
      columnName - ADQL name of DBColumn to search for.
      Returns:
      The corresponding DBColumn elements.
      See Also:
      • TextualSearchList.get(String)
    • search

      public final List<DBColumn> search(String catalog, String schema, String table, String column)
      Searches all DBColumn elements which have the given catalog, schema, table and column name (case insensitive).
      Parameters:
      catalog - Catalog name.
      schema - Schema name.
      table - Table name.
      column - Column name.
      Returns:
      The list of all matching DBColumn elements.
      See Also:
    • search

      public List<DBColumn> search(ADQLColumn column)
      Searches all DBColumn elements corresponding to the given ADQLColumn (case insensitive).
      Parameters:
      column - An ADQLColumn.
      Returns:
      The list of all corresponding DBColumn elements.
      See Also:
    • search

      public List<DBColumn> search(String catalog, String schema, String table, String column, byte caseSensitivity)
      Searches all DBColumn elements which have the given catalog, schema, table and column name, with the specified case sensitivity.
      Parameters:
      catalog - Catalog name.
      schema - Schema name.
      table - Table name.
      column - Column name.
      caseSensitivity - Case sensitivity for each column parts (one bit by part ; 0=sensitive,1=insensitive ; see IdentifierField for more details).
      Returns:
      The list of all matching DBColumn elements.
      See Also:
    • add

      public boolean add(DBColumn item)
      Specified by:
      add in interface Collection<DBColumn>
      Specified by:
      add in interface List<DBColumn>
      Overrides:
      add in class cds.utils.TextualSearchList<DBColumn>
    • addAll

      public boolean addAll(Collection<? extends DBColumn> c)
      Description copied from class: cds.utils.TextualSearchList
      Appends all the objects of the given collection in this list.
      Specified by:
      addAll in interface Collection<DBColumn>
      Specified by:
      addAll in interface List<DBColumn>
      Overrides:
      addAll in class cds.utils.TextualSearchList<DBColumn>
      Parameters:
      c - Collection of objects to add.
      Returns:
      true if this list changed as a result of the call, false otherwise.
      See Also:
    • removeAll

      public boolean removeAll(Collection<?> c)
      Specified by:
      removeAll in interface Collection<DBColumn>
      Specified by:
      removeAll in interface List<DBColumn>
      Overrides:
      removeAll in class ArrayList<DBColumn>