edu.nrao.sss.util
Enum EventSetStatus

java.lang.Object
  extended by java.lang.Enum<EventSetStatus>
      extended by edu.nrao.sss.util.EventSetStatus
All Implemented Interfaces:
Serializable, Comparable<EventSetStatus>

public enum EventSetStatus
extends Enum<EventSetStatus>

An indicator for where a collection of events is in its life cycle.

This enumeration is appropriate for the status of an event that is really a collection of finer grained events. For the most part, the statuses of an atomic event and an event that is a collection of atomic events, overlap. The one place they differ is in their treatments of "in progress" and "under way".

See also EventStatus.

Version Info:

$Revision: 2184 $
$Date: 2009-04-10 15:00:07 -0600 (Fri, 10 Apr 2009) $
$Author: dharland $ (last person to modify)

Since:
2007-08-15
Author:
David M. Harland

Enum Constant Summary
CANCELED
          Indicates that an entire set of events has been canceled.
COMPLETED
          Indicates that a set of events has been completed.
IN_PROGRESS
          Indicates that at least one event in a set is currently in progress, but says nothing about the other events in that set.
NOT_READY_TO_BE_SCHEDULED
          Indicates that no event in a set is ready for scheduling.
NOT_YET_SCHEDULED
          Indicates that no event in a set has been scheduled yet.
ON_HOLD
          Indicates that at least one event in a set has been put on hold and that none are currently in progress.
SCHEDULED_BUT_NOT_STARTED
          Indicates that no event in a set has begun yet, but that at least one has been scheduled.
UNDER_WAY
          Indicates that at least one, but not all, of the events in a set has reached the end of its life cycle.
 
Method Summary
static EventSetStatus createFrom(EventSetStatus... componentStatuses)
          Uses the componentStatuses to derive a single EventSetStatus.
static EventSetStatus createFrom(EventStatus... componentStatuses)
          Uses the componentStatuses to derive an EventSetStatus.
static EventSetStatus fromString(String text)
          Returns the status represented by text.
 boolean isFinal()
          Returns true if this status is a final status for an event.
 String toString()
          Returns a text representation of this enumeration constant.
static EventSetStatus valueOf(String name)
          Returns the enum constant of this type with the specified name.
static EventSetStatus[] 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

NOT_READY_TO_BE_SCHEDULED

public static final EventSetStatus NOT_READY_TO_BE_SCHEDULED
Indicates that no event in a set is ready for scheduling.


NOT_YET_SCHEDULED

public static final EventSetStatus NOT_YET_SCHEDULED
Indicates that no event in a set has been scheduled yet.


SCHEDULED_BUT_NOT_STARTED

public static final EventSetStatus SCHEDULED_BUT_NOT_STARTED
Indicates that no event in a set has begun yet, but that at least one has been scheduled.


IN_PROGRESS

public static final EventSetStatus IN_PROGRESS
Indicates that at least one event in a set is currently in progress, but says nothing about the other events in that set. If any one event in a set is in progress, then the set of events is also said to be in progress.

This status should be used only when an activity really is in progress. One place where this is ambiguous is as follows. Imagine that we have a container that has a collection of components. Each component has an execution status, as does the container. The execution status of the container, though, is derived from that of its components. Imagine that some of the components have been completed and that the rest of them have not yet begun. One could say that the container is "in progress", as it has begun but not yet been completed. However, we would really like to see this status used only when the activity is really happening. Had one of the above components been in progress and all others as stated above, then this status would be appropriate for the container. However, as given in the example, a better status would be UNDER_WAY.


UNDER_WAY

public static final EventSetStatus UNDER_WAY
Indicates that at least one, but not all, of the events in a set has reached the end of its life cycle. This status tells you that none of the component events are IN_PROGRESS or ON_HOLD.


COMPLETED

public static final EventSetStatus COMPLETED
Indicates that a set of events has been completed. Note that it is possible that some of the elemental events in the set may have been canceled, rather than completed. All elemental events, though, have reached the ends of their life cycles.


ON_HOLD

public static final EventSetStatus ON_HOLD
Indicates that at least one event in a set has been put on hold and that none are currently in progress. Unless one or more events in a set is IN_PROGRESS, if any event in a set is ON_HOLD, then the set itself is said to be on hold.

An actor must act to take an event out of this status. Note that this is subtly different than postponing an event, which places its status immediately back to NOT_YET_SCHEDULED.


CANCELED

public static final EventSetStatus CANCELED
Indicates that an entire set of events has been canceled. A canceled event will not be resumed or restarted.

Method Detail

values

public static EventSetStatus[] 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 (EventSetStatus c : EventSetStatus.values())
    System.out.println(c);

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

valueOf

public static EventSetStatus 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

isFinal

public boolean isFinal()
Returns true if this status is a final status for an event. CANCELED and COMPLETED are examples of final statuses.

Returns:
true if this status is a final status for an event.

createFrom

public static EventSetStatus createFrom(EventStatus... componentStatuses)
Uses the componentStatuses to derive an EventSetStatus. This method is appropriate when your event holds a collection of events, but the events that your event holds do not themselves hold other events.

Some of the rules used by this method are as follows:

  1. If the list of component statuses is null or empty, then the returned status is NOT_READY_TO_BE_SCHEDULED.
  2. If any of the component statuses are IN_PROGRESS, then the returned status is IN_PROGRESS.
  3. If all the component statuses are the same, then that singular status type is returned.
  4. We reach the next items only if none of the above resulted in an answer.

  5. If some of the component statuses are final statuses and some are nonfinal, then:
    1. if there is only a single type of non-final status, that type is returned;
    2. otherwise the returned status is UNDER_WAY.
  6. If all are final, then:
    1. if one or more component statuses are COMPLETE, then the returned status is COMPLETE;
    2. otherwise the returned status is CANCELED.
  7. If all are nonfinal, then:
    1. if one or more component statuses are SCHEDULED_BUT_NOT_STARTED, then the returned status is SCHEDULED_BUT_NOT_STARTED,
    2. otherwise the returned status is NOT_YET_SCHEDULED.

Parameters:
componentStatuses - a set of event statuses from which can be derived a single status for a set of events.
Returns:
an EventSetStatus that represents a logic combination of the componentStatuses.

createFrom

public static EventSetStatus createFrom(EventSetStatus... componentStatuses)
Uses the componentStatuses to derive a single EventSetStatus. This method is appropriate when your event holds a collection of events, each which also holds a collection of events.

Some of the rules used by this method are as follows:

  1. If the list of component statuses is null or empty, then the returned status is NOT_READY_TO_BE_SCHEDULED.
  2. If any of the component statuses are IN_PROGRESS, then the returned status is IN_PROGRESS.
  3. If all the component statuses are the same, then that singular status type is returned.
  4. We reach the next items only if none of the above resulted in an answer.

  5. If some of the component statuses are final statuses and some are nonfinal, then:
    1. if there is only a single type of non-final status, that type is returned;
    2. otherwise the returned status is UNDER_WAY.
  6. If all are final, then:
    1. if one or more component statuses are COMPLETE, then the returned status is COMPLETE;
    2. otherwise the returned status is CANCELED.
  7. If all are nonfinal, then:
    1. if one or more component statuses are UNDER_WAY, then the returned status is UNDER_WAY,
    2. otherwise, if one or more component statuses are SCHEDULED_BUT_NOT_STARTED, then the returned status is SCHEDULED_BUT_NOT_STARTED,
    3. otherwise the returned status is NOT_YET_SCHEDULED.

Parameters:
componentStatuses - a set of event set statuses from which can be derived a single status for a set of events.
Returns:
an EventSetStatus that represents a logic combination of the componentStatuses.

toString

public String toString()
Returns a text representation of this enumeration constant.

Overrides:
toString in class Enum<EventSetStatus>
Returns:
a text representation of this enumeration constant.

fromString

public static EventSetStatus fromString(String text)
Returns the status represented by text.

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

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


Copyright © 2009. All Rights Reserved.