uk.ac.starlink.vo
Class AbstractAdqlExample

java.lang.Object
  extended by uk.ac.starlink.vo.AbstractAdqlExample
All Implemented Interfaces:
AdqlExample

public abstract class AbstractAdqlExample
extends Object
implements AdqlExample

Represents a type of example ADQL query. The query text can be generated as a function of given service metadata.

Since:
29 Mar 2011
Author:
Mark Taylor

Nested Class Summary
static class AbstractAdqlExample.Breaker
          Interface for configurable line breaking.
static class AbstractAdqlExample.TableWithCols
          Encapsulates metadata for a table and a selection of colum names from it.
 
Constructor Summary
protected AbstractAdqlExample(String name, String description)
          Constructor.
 
Method Summary
static String citeColumnName(String colName)
          Fixes a colum name so it's suitable for insersion into ADQL.
static String citeTableName(String tname)
          Fixes a table name so it's suitable for insertion into ADQL.
static AbstractAdqlExample.Breaker createBreaker(boolean lineBreaks)
          Returns a breaker instance suitable for a given line break policy.
static AdqlExample createDummyExample()
          Returns a dummy example which never provides any text.
static AdqlExample[] createSomeExamples()
          Returns a selection of examples.
 String getDescription()
          Returns this example's description.
 String getName()
          Returns this example's name.
static AbstractAdqlExample.TableWithCols[] getRaDecTables(TableMeta[] tables, int max)
          Identifies tables in a given array which contain RA/Dec positional columns.
static TableMeta[] toTables(TableMeta table, TableMeta[] tables)
          Utility function to turn a single table and a table array into a single array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.starlink.vo.AdqlExample
getText
 

Constructor Detail

AbstractAdqlExample

protected AbstractAdqlExample(String name,
                              String description)
Constructor.

Parameters:
name - example name
description - example short description
Method Detail

getName

public String getName()
Description copied from interface: AdqlExample
Returns this example's name.

Specified by:
getName in interface AdqlExample
Returns:
name

getDescription

public String getDescription()
Description copied from interface: AdqlExample
Returns this example's description.

Specified by:
getDescription in interface AdqlExample
Returns:
short description

createBreaker

public static AbstractAdqlExample.Breaker createBreaker(boolean lineBreaks)
Returns a breaker instance suitable for a given line break policy.

Parameters:
lineBreaks - whether line breaks are required
Returns:
breaker instance

citeTableName

public static String citeTableName(String tname)
Fixes a table name so it's suitable for insertion into ADQL. It is quoted if necessary, but not otherwise.

Parameters:
tname - raw table name, may include delimiters (schema.table etc)
Returns:
name suitable for use in ADQL

citeColumnName

public static String citeColumnName(String colName)
Fixes a colum name so it's suitable for insersion into ADQL. It is quoted if necessary, but not otherwise.

Parameters:
colName - raw column name, may not include delimiters
Returns:
name suitable for use in ADQL

toTables

public static TableMeta[] toTables(TableMeta table,
                                   TableMeta[] tables)
Utility function to turn a single table and a table array into a single array. The input single table may or may not appear in the input table array; it will not appear twice in the output array.

Parameters:
table - single input table, or null
tables - input table array
Returns:
output table array

getRaDecTables

public static AbstractAdqlExample.TableWithCols[] getRaDecTables(TableMeta[] tables,
                                                                 int max)
Identifies tables in a given array which contain RA/Dec positional columns.

Parameters:
tables - candidate table list
max - the maximum number of output tables required
Returns:
array of tables with RA/Dec columns

createDummyExample

public static AdqlExample createDummyExample()
Returns a dummy example which never provides any text.

Returns:
dummy example

createSomeExamples

public static AdqlExample[] createSomeExamples()
Returns a selection of examples.

Returns:
example list


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.