HiRISE

HiRISE.HiPlan.Data_Slacker
Class SsrDrain

java.lang.Object
  extended by HiRISE.HiPlan.Data_Slacker.AbstractSsrTransaction
      extended by HiRISE.HiPlan.Data_Slacker.SsrDrain
All Implemented Interfaces:
SsrTransaction, Comparable<SsrDrain>

public final class SsrDrain
extends AbstractSsrTransaction
implements Comparable<SsrDrain>

A representation of a drain from the MRO SSR, such as a downlink event. This drain does not distinguish between transactions between the MRO raw and framed partitions, nor does it distinguish between X-band and Ka-band downlink events.

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

Version:
1.6
Author:
Christian Schaller - UA/PIRL

Field Summary
static String DEFAULT_LABEL
          The default label for SSR drains.
static String ID
          Class identification name with source code version and date.
static SsrDrain LAST_DRAIN
          An SSR drain at the end of Java time.
 
Constructor Summary
SsrDrain(edu.asu.jmars.layer.obs.mro.DLinkRec dlink, double dlinkFraction)
          Creates a new SSR drain from an MTT downlink record.
SsrDrain(DLinkRecord dlinkRecord, double dlinkFraction)
          Creates a new SSR drain from a HiPlan downlink record.
 
Method Summary
 int compareTo(SsrDrain s)
          Compares one SSR drain to another.
 boolean equals(Object o)
          Indicates whether some other object is "equal to" this one.
 long getBits()
          Gets the total number of bits transferred in the transaction.
 Date getEndDate()
          Gets the end date of the transaction.
 long getEndMillis()
          Gets the end date of the transaction in milliseconds.
 String getLabel()
          Gets the drain's label.
 Date getStartDate()
          Gets the start date of the transaction.
 long getStartMillis()
          Gets the start date of the transaction in milliseconds.
 int hashCode()
          Returns a hash code value for this transaction.
 String toString()
          Gets a string representation of this transaction.
 
Methods inherited from class HiRISE.HiPlan.Data_Slacker.AbstractSsrTransaction
getDuration, getRate
 
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

LAST_DRAIN

public static final SsrDrain LAST_DRAIN
An SSR drain at the end of Java time. The start and end values are Long.MAX_VALUE, it has no bits (0L), and its label is INVALID.


DEFAULT_LABEL

public static final String DEFAULT_LABEL
The default label for SSR drains.

See Also:
Constant Field Values
Constructor Detail

SsrDrain

public SsrDrain(edu.asu.jmars.layer.obs.mro.DLinkRec dlink,
                double dlinkFraction)
Creates a new SSR drain from an MTT downlink record. An allocation fraction is applied to the downlink record's downlink bits. If, for example, only HiRISE observations are considered in the downlink and HiRISE is allocated 35% of the total downlink, the dlinkFraction value used in construction would be 0.35.

The SSR drain is assigned the label SSR Drain.

Parameters:
dlink - the MTT downlink record.
dlinkFraction - the fraction of the downlink record's downlink bits to be used by this SSR drain.
Throws:
NullPointerException - if the downlink record is null.
IllegalArgumentException - if the downlink record's start or end times are invalid.

SsrDrain

public SsrDrain(DLinkRecord dlinkRecord,
                double dlinkFraction)
Creates a new SSR drain from a HiPlan downlink record. An allocation fraction is applied to the downlink record's downlink bits. If, for example, only HiRISE observations are considered in the downlink and HiRISE is allocated 35% of the total downlink, the dlinkFraction value used in construction would be 0.35.

The SSR drain is assigned the label SSR Drain.

Parameters:
dlinkRecord - the HiPlan downlink record.
dlinkFraction - the fraction of the downlink record's downlink bits to be used by this SSR drain.
Method Detail

getLabel

public String getLabel()
Gets the drain's label. Note that the label field is optional and may be null. It is not significant.

Returns:
the label; may be null.

getStartMillis

public long getStartMillis()
Gets the start date of the transaction in milliseconds.

Specified by:
getStartMillis in interface SsrTransaction
Returns:
the transaction start date in milliseconds as defined by Date.

getEndMillis

public long getEndMillis()
Gets the end date of the transaction in milliseconds.

Specified by:
getEndMillis in interface SsrTransaction
Returns:
the transaction end date in milliseconds as defined by Date.

getBits

public long getBits()
Gets the total number of bits transferred in the transaction.

Specified by:
getBits in interface SsrTransaction
Returns:
the number of bits transferred.

getStartDate

public Date getStartDate()
Gets the start date of the transaction. This value is simply the getStartMillis() value used in the construction of a new Date.

Returns:
the transaction's start date.

getEndDate

public Date getEndDate()
Gets the end date of the transaction. This value is simply the getEndMillis() value used in the construction of a new Date.

Returns:
the transaction's end date.

toString

public String toString()
Gets a string representation of this transaction. 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 transaction.

hashCode

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

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

equals

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

Two inputs are equal if and only if they have the same start date, end date, and bits transferred. Note that because the getLabel() field is not significant, it is not included in the determination. Two SSR drains with identical start and end times and number of bits transferred 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(SsrDrain s)
Compares one SSR drain to another. This drain is less than the other if its getStartMillis() is less than the other's. If the values are the same, the getEndMillis() values are compared. If these are the same, the getBits() values are compared. If these are the same, then the two SSR drains 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<SsrDrain>
Parameters:
s - the SSR drain to be compared.
Returns:
-1, 0, or 1 as this input is less than, equal to, or greater than the specified drain.

HiRISE

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