uk.ac.starlink.topcat
Class TopcatUtils

java.lang.Object
  extended by uk.ac.starlink.topcat.TopcatUtils

public class TopcatUtils
extends Object

Class containing miscellaneous static methods and constants for use in TOPCAT.

Since:
19 Aug 2004
Author:
Mark Taylor

Field Summary
static uk.ac.starlink.table.ValueInfo ACTIVATORS_INFO
          Parameter key for storing an activation action for a table.
static uk.ac.starlink.table.ValueInfo BASE_DESCRIPTION_INFO
          Column auxiliary metadata key identifying the description of columns which also have an expression (EXPR_INFO) entry.
static uk.ac.starlink.table.ValueInfo COLID_INFO
          Column auxiliary metadata key identifying the uniqe column identifier for use in algebraic expressions.
static String DEMO_LOCATION
           
static String DEMO_NODES
           
static String DEMO_TABLE
           
static uk.ac.starlink.table.ValueInfo EXPR_INFO
          Column auxiliary metadata key identifying the text string which gives an expression for a synthetic column.
static uk.ac.starlink.table.ValueInfo NUMERIC_CONVERTER_INFO
          Column auxiliary metadata key identifying an object which can convert from non-numeric cell values to numeric ones.
static String STATUS_URL
           
static uk.ac.starlink.table.ValueInfo TIME_INFO
          Data identifier for epoch-type data.
static String VERSION_RESOURCE
           
 
Constructor Summary
TopcatUtils()
           
 
Method Summary
static boolean canExec()
          Indicates whether we have System.exec permission.
static boolean canJel()
          Indicates if it's possible to use JEL to compile algebraic expressions.
static boolean canSog()
          Indicates whether there are enough classes to make SoG work at runtime.
static void enquireLatestVersion()
          Ascertains the most recent release using an external connection, and reports through the logging system as appropriate.
static boolean equals(Object o1, Object o2)
          Determines whether two objects are equal in the sense of Object.equals(java.lang.Object).
static String formatLong(long num)
          Formats a long value for presentation as text.
static String[] getAbout()
          Returns some lines of text describing this copy of the software including its version and versions of some important components.
static String getApplicationName()
          Returns the name of this application.
static String getBaseDescription(uk.ac.starlink.table.ColumnInfo info)
          Returns the 'base description' of a column info.
static String getBaseName(String origName, String baseSuffix)
          Returns the base name of a column; that is one without any suffix based on baseSuffix.
static String getDistinctName(ColumnList colList, String origName, String baseSuffix)
          Returns a column name based on a given one which is guaranteed distinct from any others in the column list.
static String getExpression(uk.ac.starlink.table.ColumnInfo info)
          Returns the expression text for a column.
static String getRevision()
          Returns the subversion revision number for TOPCAT and its dependencies.
static String getSTILVersion()
          Returns the version string for the version of STIL being used here.
static String getVersion()
          Returns the version string for this copy of TOPCAT.
static void memoryError(OutOfMemoryError e)
          Alerts the user that the system has run out of memory, and provides the option of some useful tips.
static void memoryErrorLater(OutOfMemoryError e)
          Queues a memoryError(java.lang.OutOfMemoryError) call for later execution on the event dispatch thread.
static void setBaseDescription(uk.ac.starlink.table.ColumnInfo info, String desc)
          Sets the 'base description' of a column info.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEMO_LOCATION

public static String DEMO_LOCATION

DEMO_TABLE

public static String DEMO_TABLE

DEMO_NODES

public static String DEMO_NODES

VERSION_RESOURCE

public static final String VERSION_RESOURCE
See Also:
Constant Field Values

STATUS_URL

public static final String STATUS_URL
See Also:
Constant Field Values

COLID_INFO

public static final uk.ac.starlink.table.ValueInfo COLID_INFO
Column auxiliary metadata key identifying the uniqe column identifier for use in algebraic expressions.


BASE_DESCRIPTION_INFO

public static final uk.ac.starlink.table.ValueInfo BASE_DESCRIPTION_INFO
Column auxiliary metadata key identifying the description of columns which also have an expression (EXPR_INFO) entry.


EXPR_INFO

public static final uk.ac.starlink.table.ValueInfo EXPR_INFO
Column auxiliary metadata key identifying the text string which gives an expression for a synthetic column.


NUMERIC_CONVERTER_INFO

public static final uk.ac.starlink.table.ValueInfo NUMERIC_CONVERTER_INFO
Column auxiliary metadata key identifying an object which can convert from non-numeric cell values to numeric ones.


ACTIVATORS_INFO

public static final uk.ac.starlink.table.ValueInfo ACTIVATORS_INFO
Parameter key for storing an activation action for a table.


TIME_INFO

public static final uk.ac.starlink.table.ValueInfo TIME_INFO
Data identifier for epoch-type data.

Constructor Detail

TopcatUtils

public TopcatUtils()
Method Detail

getBaseDescription

public static String getBaseDescription(uk.ac.starlink.table.ColumnInfo info)
Returns the 'base description' of a column info. This is the same as the description, except for synthetic columns, where it doesn't contain a respresentation of the algebraic expression.

Parameters:
info - column info
Returns:
base description of colinfo

setBaseDescription

public static void setBaseDescription(uk.ac.starlink.table.ColumnInfo info,
                                      String desc)
Sets the 'base description' of a column info. This sets the future result of calls to getBaseDescription(uk.ac.starlink.table.ColumnInfo) and also the description string itself (DefaultValueInfo.getDescription()).

Parameters:
info - column info to modify
desc - base description string (don't include expression text)

getExpression

public static String getExpression(uk.ac.starlink.table.ColumnInfo info)
Returns the expression text for a column. This should only have a non-null value for synthetic columns.

Parameters:
info - column info
Returns:
synthetic expression string

getBaseName

public static String getBaseName(String origName,
                                 String baseSuffix)
Returns the base name of a column; that is one without any suffix based on baseSuffix. This method is used in conjunction with getDistinctName(uk.ac.starlink.topcat.ColumnList, java.lang.String, java.lang.String).

Parameters:
origName - full name, possibly including bits of suffix
baseSuffix - the base suffix string
Returns:
name without any suffix-like elements of the sort specified by baseSuffix

getDistinctName

public static String getDistinctName(ColumnList colList,
                                     String origName,
                                     String baseSuffix)
Returns a column name based on a given one which is guaranteed distinct from any others in the column list. If the submitted origName is already unique, it may be returned. Otherwise a new name may be made which involves appending the given baseSuffix to it.

Parameters:
colList - column list within which distinct naming is required
origName - initial name
baseSuffix - suffix used for deduplication
Returns:
a name resembling origName which is not the same as any existing column names in colList
See Also:
getBaseName(java.lang.String, java.lang.String)

getApplicationName

public static String getApplicationName()
Returns the name of this application.

Returns:
"TOPCAT"

getAbout

public static String[] getAbout()
Returns some lines of text describing this copy of the software including its version and versions of some important components.

Returns:
lines of About text

memoryError

public static void memoryError(OutOfMemoryError e)
Alerts the user that the system has run out of memory, and provides the option of some useful tips.

Parameters:
e - exception, or null

memoryErrorLater

public static void memoryErrorLater(OutOfMemoryError e)
Queues a memoryError(java.lang.OutOfMemoryError) call for later execution on the event dispatch thread.

Parameters:
e - exception, or null

canSog

public static boolean canSog()
Indicates whether there are enough classes to make SoG work at runtime.

Returns:
true iff it's safe to use a SoG-based viewer

canExec

public static boolean canExec()
Indicates whether we have System.exec permission.

Returns:
true if it's possible to exec

canJel

public static boolean canJel()
Indicates if it's possible to use JEL to compile algebraic expressions. If the security manager does not permit creation of private class loaders, it will fail.

Returns:
true iff JEL epxression compilation will work

getVersion

public static String getVersion()
Returns the version string for this copy of TOPCAT.

Returns:
version number only

getRevision

public static String getRevision()
Returns the subversion revision number for TOPCAT and its dependencies.

Returns:
svn revision

getSTILVersion

public static String getSTILVersion()
Returns the version string for the version of STIL being used here.

Returns:
STIL version number

enquireLatestVersion

public static void enquireLatestVersion()
Ascertains the most recent release using an external connection, and reports through the logging system as appropriate.


equals

public static boolean equals(Object o1,
                             Object o2)
Determines whether two objects are equal in the sense of Object.equals(java.lang.Object). Unlike that method however, it returns true if both objects are null, and won't throw a NullPointerException.

Parameters:
o1 - first object
o2 - second object
Returns:
true if o1.equals(o2) or they're both null

formatLong

public static String formatLong(long num)
Formats a long value for presentation as text. This typically puts separators between groups of three numbers for improved visibility. TOPCAT policy is usually to do this only for numbers which are, or might be expected to be, quite large.

Parameters:
num - number to format
Returns:
formatted value


Copyright © 2003-2013 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.