Package adql.db

Class SearchColumnList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<DBColumn>, java.util.Collection<DBColumn>, java.util.List<DBColumn>, java.util.RandomAccess

    public class SearchColumnList
    extends 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.

    Version:
    1.4 (09/2017)
    Author:
    Grégory Mantelet (CDS;ARI)
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SearchColumnList()
      Void constructor.
      SearchColumnList​(int initialCapacity)
      Constructor with the initial capacity.
      SearchColumnList​(java.util.Collection<DBColumn> collection)
      Constructor by copy: all the elements of the given collection of DBColumn are copied ordered into this list.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(DBColumn item)
      Adds the given object at the end of this list.
      boolean addAll​(java.util.Collection<? extends DBColumn> c)
      Appends all the objects of the given collection in this list.
      int getNbTableAliases()  
      boolean isDistinct()
      Tells whether multiple occurrences are allowed.
      void putTableAlias​(java.lang.String tableAlias, java.lang.String tableName)
      Adds the given association between a table name and its alias in a query.
      boolean removeAll​(java.util.Collection<?> c)  
      void removeAllTableAliases()
      Removes all table name/alias associations.
      void removeTableAlias​(java.lang.String tableAlias)
      Removes the given alias from this list.
      java.util.List<DBColumn> search​(ADQLColumn column)
      Searches all DBColumn elements corresponding to the given ADQLColumn (case insensitive).
      java.util.List<DBColumn> search​(java.lang.String columnName)
      Searches all DBColumn elements which has the given name (case insensitive).
      java.util.List<DBColumn> search​(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String column)
      Searches all DBColumn elements which have the given catalog, schema, table and column name (case insensitive).
      java.util.List<DBColumn> search​(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String column, byte caseSensitivity)
      Searches all DBColumn elements which have the given catalog, schema, table and column name, with the specified case sensitivity.
      void setDistinct​(boolean distinct)
      Lets indicating that multiple occurrences are allowed.
      • Methods inherited from class java.util.ArrayList

        clone, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeIf, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Constructor Detail

      • SearchColumnList

        public SearchColumnList()
        Void constructor.
      • SearchColumnList

        public SearchColumnList​(java.util.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 Detail

      • 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​(java.lang.String tableAlias,
                                        java.lang.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​(java.lang.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 java.util.List<DBColumn> search​(java.lang.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 java.util.List<DBColumn> search​(java.lang.String catalog,
                                                     java.lang.String schema,
                                                     java.lang.String table,
                                                     java.lang.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(String, String, String, String, byte)
      • search

        public java.util.List<DBColumn> search​(java.lang.String catalog,
                                               java.lang.String schema,
                                               java.lang.String table,
                                               java.lang.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:
        IdentifierField
      • add

        public boolean add​(DBColumn item)
        Description copied from class: TextualSearchList
        Adds the given object at the end of this list.
        Specified by:
        add in interface java.util.Collection<DBColumn>
        Specified by:
        add in interface java.util.List<DBColumn>
        Overrides:
        add in class TextualSearchList<DBColumn>
        Parameters:
        item - Object to add (different from NULL).
        See Also:
        ArrayList.add(java.lang.Object)
      • addAll

        public boolean addAll​(java.util.Collection<? extends DBColumn> c)
        Description copied from class: TextualSearchList
        Appends all the objects of the given collection in this list.
        Specified by:
        addAll in interface java.util.Collection<DBColumn>
        Specified by:
        addAll in interface java.util.List<DBColumn>
        Overrides:
        addAll in class 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:
        ArrayList.addAll(java.util.Collection), TextualSearchList.add(Object)
      • removeAll

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