HiRISE

HiRISE.HiPlan.Data_Slacker
Class SsrState

java.lang.Object
  extended by HiRISE.HiPlan.Data_Slacker.SsrState
All Implemented Interfaces:
Comparable<SsrState>

public class SsrState
extends Object
implements Comparable<SsrState>

A representation of the MRO SSR state at a particular sample time. The state consists of the sample time, the number of bits in storage, and a label. Note that this class makes no distinction between raw and framed space nor between X- and Ka-band partitions.

The label field is optional and not significant. It is not considered in the equals(Object), hashCode(), or compareTo(SsrState) methods.

Version:
1.5
Author:
Christian Schaller - UA/PIRL

Field Summary
static String ID
          Class identification name with source code version and date.
static String INITIAL_STATE_LABEL
          The label for the SSR initial state when created by the makeInitialState(Date,long) or makeInitialState(long,long) methods.
 
Constructor Summary
SsrState(Date date, long bits)
          Creates a new SSR state at the given sample time and with the given number of bits in storage.
SsrState(Date date, long bits, String label)
          Creates a new SSR state at the given sample time, with the given number of bits in storage, and with the given label.
SsrState(long dateMillis, long bits)
          Creates a new SSR state at the given time and with the given number of bits in storage.
SsrState(long dateMillis, long bits, String label)
          Creates a new SSR state with the given sample time, with the given number of bits in storage, and with the given label.
 
Method Summary
 int compareTo(SsrState s)
          Compares one SSR state to another.
 boolean equals(Object o)
          Indicates whether some other object is "equal to" this one.
 long getBits()
          Gets this SSR state's number of bits in storage.
 Date getDate()
          Gets the sample date of this SSR state.
 long getDateMillis()
          Gets this SSR state's sample date in milliseconds.
 String getLabel()
          Gets this SSR state's optional label.
 int hashCode()
          Returns a hash code value for this SSR state.
static SsrState makeInitialState(Date date, long bits)
          Produces an SSR state with the given sample date and number of bits.
static SsrState makeInitialState(long millis, long bits)
          Produces an SSR state with the given sample date in milliseconds and number of bits.
 String toString()
          Gets a string representation of this SSR state.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

public static final String ID
Class identification name with source code version and date.

See Also:
Constant Field Values

INITIAL_STATE_LABEL

public static final String INITIAL_STATE_LABEL
The label for the SSR initial state when created by the makeInitialState(Date,long) or makeInitialState(long,long) methods.

See Also:
Constant Field Values
Constructor Detail

SsrState

public SsrState(Date date,
                long bits,
                String label)
Creates a new SSR state at the given sample time, with the given number of bits in storage, and with the given label.

Parameters:
date - the sample date for this particular SSR state.
bits - the number of bits in storage.
label - an optional label; may be null.

SsrState

public SsrState(Date date,
                long bits)
Creates a new SSR state at the given sample time and with the given number of bits in storage. The state has no label.

Parameters:
date - the sample date for this particular SSR state.
bits - the number of bits in storage.

SsrState

public SsrState(long dateMillis,
                long bits,
                String label)
Creates a new SSR state with the given sample time, with the given number of bits in storage, and with the given label.

Parameters:
dateMillis - the sample date for this particular SSR state, in milliseconds as defined by Date.
bits - the number of bits in storage.
label - an optional label; may be null.

SsrState

public SsrState(long dateMillis,
                long bits)
Creates a new SSR state at the given time and with the given number of bits in storage. The state has no label.

Parameters:
dateMillis - the sample date for this particular SSR state, in milliseconds as defined by Date.
bits - the number of bits in storage.
Method Detail

getDateMillis

public long getDateMillis()
Gets this SSR state's sample date in milliseconds. The value is as defined by Date.

Returns:
the sample date in milliseconds.

getBits

public long getBits()
Gets this SSR state's number of bits in storage.

Returns:
the number of bits in storage.

getLabel

public String getLabel()
Gets this SSR state's optional label.

Returns:
the label, which may be null.

getDate

public Date getDate()
Gets the sample date of this SSR state. This value is simply the getDateMillis() value used in the construction of a new Date.

Returns:
the sample date.

toString

public String toString()
Gets a string representation of this SSR state. Although the getLabel() is not a significant field, it is included in the string representation.

Overrides:
toString in class Object
Returns:
a string representation of this SSR state.

hashCode

public int hashCode()
Returns a hash code value for this SSR state. Note that because the getLabel() field is not significant, it is not included in the calculation. Two SSR states with identical sample dates and number of bits will have identical hash codes, even if they have different labels.

Overrides:
hashCode in class Object
Returns:
a hash code value for this SSR state.

equals

public boolean equals(Object o)
Indicates whether some other object is "equal to" this one.

Two SSR states are equal if and only if they have the same sample date and number of bits. Note that because the getLabel() field is not significant, it is not included in the determination. Two SSR states with identical sample dates and number of bits will be "equal," even if they have different labels.

Overrides:
equals in class Object
Parameters:
o - the object to which this object is compared.
Returns:
true if the objects are equal; false otherwise.

compareTo

public int compareTo(SsrState s)
Compares one SSR state to another. This state is less than the other if its getDateMillis() is less than the other's. If the values are the same, the getBits() values are compared. If these are the same, then the two SSR states are considered equal.

Note that because the getLabel() field is not significant, it is not included in the calculation.

Specified by:
compareTo in interface Comparable<SsrState>
Parameters:
s - the SSR state to be compared.
Returns:
-1, 0, or 1 as this state is less than, equal to, or greater than the specified input.

makeInitialState

public static SsrState makeInitialState(Date date,
                                        long bits)
Produces an SSR state with the given sample date and number of bits. The label is set to Initial State.

Parameters:
date - the sample date for the initial SSR state.
bits - the number of bits.
Returns:
an SSR state.

makeInitialState

public static SsrState makeInitialState(long millis,
                                        long bits)
Produces an SSR state with the given sample date in milliseconds and number of bits. The label is set to Initial State.

Parameters:
millis - the sample date for the initial SSR state in milliseconds as defined by Date.
bits - the number of bits.
Returns:
an SSR state.

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona