edu.nrao.sss.model.project
Enum ScientificPriority

java.lang.Object
  extended by java.lang.Enum<ScientificPriority>
      extended by edu.nrao.sss.model.project.ScientificPriority
All Implemented Interfaces:
Serializable, Comparable<ScientificPriority>

public enum ScientificPriority
extends Enum<ScientificPriority>

An enumeration of scientific priorities.

A lower number represents a higher priority.

Since:
2006-03-09
Version:
1.1

Enum Constant Summary
FOUR
          The lowest priority (except for that of the UNKNOWN priority).
ONE
          An intermediate priority that is lower than ZERO but higher than TWO.
THREE
          An intermediate priority that is lower than TWO but higher than FOUR.
TWO
          An intermediate priority that is lower than ONE but higher than THREE.
UNKNOWN
          Represents a scientific priority of unknown type.
ZERO
          The highest priority.
 
Method Summary
static ScientificPriority fromString(String text)
          Returns the scientific priority represented by text.
static ScientificPriority getDefault()
          Returns a default scientific priority.
static EnumSet<ScientificPriority> getPrioritiesFor(TelescopeType telescope)
          Returns a set of enumerations that is appropriate for the given telescope.
 boolean isHigherPriorityThan(ScientificPriority otherSciPri)
          Returns true if this priority is higher (more important) than otherSciPri.
 char toChar()
          Returns a single character that represents this priority.
 int toInt()
          Returns a numeric representation of this priority.
 String toString()
           
 String toString(TelescopeType telescope)
          Returns a text representation of this priority that is appropriate for the given telescope.
static ScientificPriority valueOf(String name)
          Returns the enum constant of this type with the specified name.
static ScientificPriority[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ZERO

public static final ScientificPriority ZERO
The highest priority.

The acceptable names of this element (for use with getInstanceFromName(String)) are ZERO, 0, and A.


ONE

public static final ScientificPriority ONE
An intermediate priority that is lower than ZERO but higher than TWO.

The acceptable names of this element (for use with getInstanceFromName(String)) are ONE, 1, and B.


TWO

public static final ScientificPriority TWO
An intermediate priority that is lower than ONE but higher than THREE.

The acceptable names of this element (for use with getInstanceFromName(String)) are TWO, 2, and C.


THREE

public static final ScientificPriority THREE
An intermediate priority that is lower than TWO but higher than FOUR.

The acceptable names of this element (for use with getInstanceFromName(String)) are THREE, 3, and D.


FOUR

public static final ScientificPriority FOUR
The lowest priority (except for that of the UNKNOWN priority).

The acceptable names of this element (for use with getInstanceFromName(String)) are FOUR, 4, and E.


UNKNOWN

public static final ScientificPriority UNKNOWN
Represents a scientific priority of unknown type.

This priority is lower than all others.

This element is used to implement the Null Object Pattern. In situations where a method might be tempted to return null, this element is returned instead.

Method Detail

values

public static ScientificPriority[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ScientificPriority c : ScientificPriority.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ScientificPriority valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

toInt

public int toInt()
Returns a numeric representation of this priority.

Returns:
a numeric representation of this priority.

toChar

public char toChar()
Returns a single character that represents this priority.

Returns:
a single character that represents this priority.

toString

public String toString(TelescopeType telescope)
Returns a text representation of this priority that is appropriate for the given telescope. For the TelescopeType.GBT, this is a single alphabetic character. Otherwise, this is an integer.

Parameters:
telescope - the telescope for which a text representation of this priority is desired.
Returns:
a text representation of this priority.

toString

public String toString()
Overrides:
toString in class Enum<ScientificPriority>

isHigherPriorityThan

public boolean isHigherPriorityThan(ScientificPriority otherSciPri)
Returns true if this priority is higher (more important) than otherSciPri.

Parameters:
otherSciPri - the other priority to which this one is compared.
Returns:
true if this priority is higher otherSciPri.

getPrioritiesFor

public static EnumSet<ScientificPriority> getPrioritiesFor(TelescopeType telescope)
Returns a set of enumerations that is appropriate for the given telescope.

Since GBT uses only the priorities A, B, and C, only the priorities with these toChar() properties are contained in the set. Otherwise, all priorities except for the UNKNOWN priority are in the returned set.

Parameters:
telescope - the telescope for which a set of priorities is needed.
Returns:
a set of priorities for the given telescope.

getDefault

public static ScientificPriority getDefault()
Returns a default scientific priority.

Returns:
a default scientific priority.

fromString

public static ScientificPriority fromString(String text)
Returns the scientific priority represented by text.

For details about the transformation, see EnumerationUtility.enumFromString(Class, String).

Parameters:
text - a text representation of a scientific priority.
Returns:
the scientific priority represented by text.


Copyright © 2009. All Rights Reserved.