HiRISE

HiRISE.HiPlan.Data_Slacker
Class DLinkRecord

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

public final class DLinkRecord
extends AbstractSsrTransaction
implements Comparable<DLinkRecord>

A representation of a record from an MTT downlink volume file. It represents the complete downlink volume for a particular downlink activity, rather than a per-instrument downlink volume. The DLinkFile's header contains the instrument allocations, which may be used to construct per-instrument SsrDrain objects from DLinkRecords.

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

Version:
1.1
Author:
Christian Schaller - UA/PIRL
See Also:
"Mars Target Tool Downlink Volume File Software Interface Specification (JPL MRO SEQ033)"

Nested Class Summary
static class DLinkRecord.DownlinkBand
          An enumeration of the MRO downlink bands.
 
Field Summary
static String DEFAULT_LABEL
          The default label for downlink volume records.
static String ID
          Class identification name with source code version and date.
 
Constructor Summary
DLinkRecord(String recordText, String label)
          Creates a new downlink record from a line of text from an MTT downlink volume file.
 
Method Summary
 int compareTo(DLinkRecord s)
          Compares one downlink record 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.
 DLinkRecord.DownlinkBand getDownlinkBand()
          Gets the record's downlink band.
 Date getEndDate()
          Gets the end date of the transaction.
 long getEndMillis()
          Gets the end date of the transaction in milliseconds.
 String getLabel()
          Gets the record'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.
 SsrDrain makeSsrDrain(double dlinkFraction)
          Creates an SSR drain from this downlink record.
 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

DEFAULT_LABEL

public static final String DEFAULT_LABEL
The default label for downlink volume records.

See Also:
Constant Field Values
Constructor Detail

DLinkRecord

public DLinkRecord(String recordText,
                   String label)
Creates a new downlink record from a line of text from an MTT downlink volume file. An optional label may be included; if null, DLink Record is used.

Parameters:
recordText - the text record from the downlink volume file.
label - an optional label for the record; may be null.
Throws:
NullPointerException - if the record text is null.
IllegalArgumentException - if the record text is empty or if the text is not of the correct format.
Method Detail

getLabel

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

Returns:
the label; may be null.

getDownlinkBand

public DLinkRecord.DownlinkBand getDownlinkBand()
Gets the record's downlink band.

Returns:
the downlink band.

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 downlink records with identical start and end times, number of bits transferred, and downlink bands 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 downlink records are equal if and only if they have the same start date, end date, bits transferred, and downlink bands. Note that because the getLabel() field is not significant, it is not included in the determination. Two downlink records with identical start and end times, number of bits transferred, and downlink bands 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(DLinkRecord s)
Compares one downlink record to another. This record 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, the getDownlinkBand() values are compared. If these are the same, then the two downlink records are considered equal.

In comparing the downlink bands, DLinkRecord.DownlinkBand.X_BAND is considered "less than" DLinkRecord.DownlinkBand.KA_BAND.

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

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

makeSsrDrain

public SsrDrain makeSsrDrain(double dlinkFraction)
Creates an SSR drain from this downlink record. An allocation fraction is applied to this record's downlink bits for the SSR drain. 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.

Parameters:
dlinkFraction - the fraction of the downlink record's downlink bits to be used by the SSR drain.
Returns:
the SSR drain component.

HiRISE

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