astro
Class ConstellationFactory

java.lang.Object
  extended by astro.ConstellationFactory

public class ConstellationFactory
extends Object

A class to provide outlines of constellations as shapes. Each constellation is stored in a file named 'xxx.con', where xxx is the three-letter abbreviation of the constellation. Each file consists of a single line taht is a parsbale SkyPath expression. The constellations files are produced using the ConstellationShape class for transforming xxx.hip input files into constellation files.


Nested Class Summary
static class ConstellationFactory.Hip
          A class to convert constellation input files that use HIP-numbers to parsable SkyPath objects.
 
Field Summary
private static String CONSTELLATIONEXTENSION
          The constellation extension.
private static String DEFURLRESOURCES
          The default resources of the constellation files.
private static ClassLoader locate
          An url-class loader if the DEFURLRESOURCES is defined.
 
Constructor Summary
ConstellationFactory()
           
 
Method Summary
static Map getAllConstellations(CoordinateTransforming radec)
          Returns an array of all constellations that can be parsed and are non-null.
static Shape getConstellation(String name, CoordinateTransforming radec)
          Returns a constellation shape using its name.
private static InputStream getResourceAsStream(String key)
          Locates a resource using either the default class loader or the URLClassLoader defined with DEFURLRESOURCES.
private static ClassLoader loadResource()
          Loads an URL class loader to this properties.
static void setClassLoader(ClassLoader c)
          Sets a class loader for locating resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFURLRESOURCES

private static final String DEFURLRESOURCES
The default resources of the constellation files.

See Also:
Constant Field Values

CONSTELLATIONEXTENSION

private static final String CONSTELLATIONEXTENSION
The constellation extension.

See Also:
Constant Field Values

locate

private static ClassLoader locate
An url-class loader if the DEFURLRESOURCES is defined.

Constructor Detail

ConstellationFactory

public ConstellationFactory()
Method Detail

setClassLoader

public static void setClassLoader(ClassLoader c)
Sets a class loader for locating resources.


getConstellation

public static Shape getConstellation(String name,
                                     CoordinateTransforming radec)
Returns a constellation shape using its name.


getAllConstellations

public static Map getAllConstellations(CoordinateTransforming radec)
Returns an array of all constellations that can be parsed and are non-null.


getResourceAsStream

private static InputStream getResourceAsStream(String key)
Locates a resource using either the default class loader or the URLClassLoader defined with DEFURLRESOURCES. As for the general contract for resource-finding, first the main class loader tries to locate the resource and only if it failes, the URL's are searched.


loadResource

private static ClassLoader loadResource()
Loads an URL class loader to this properties.