HiRISE

HiRISE.HiPlan.HiSEAS
Class MroObservation.Builder

java.lang.Object
  extended by HiRISE.HiPlan.HiSEAS.MroObservation.Builder
Enclosing class:
MroObservation

public static class MroObservation.Builder
extends Object

A builder for an immutable MRO observation.

To use the builder, instantiate it with an orbital data model, optionally set a label and/or comment, and invoke the build() method. For example, to create a new observation of a Target called aramChaos on orbit 13203, use the following code:

        OrbitalData orbitalData = MroObservation.OrbitalData.findData (
                aramChaos,
                13203
        );
        MroObservation observation = new MroObservation.Builder (
                orbitalData
        ).label ("ESP_013203_1825").comment ("Stereo-1 of Aram Chaos").build ();

Alternatively, if the ephemeris time and roll angle are already known via another source, the builder may be instantiated with the target, orbit, ephemeris time, and roll angle directly. For example, the same observation may be obtained with the following code:

        MroObservation observation = new MroObservation.Builder (
                aramChaos,
                Orbit.valueOf ("13203a"),
                296161196.352,
                Math.toRadians (-23.653)
        ).label ("ESP_013203_1825").comment ("Stereo-1 of Aram Chaos").build ();

Note that the builder (and the resultant observation) assume the roll angle is in radians.

The NAIF ID of the target's body must be 499 (Mars). If not, an IllegalArgumentException will be thrown.

The resultant observation's Observer will be the shared MRO instance, which represents the MRO spacecraft in the IAU Mars body-fixed reference frame.

It is assumed that all necessary SPICE kernels are loaded into the SPICE kernel pool when the observation is constructed; if not, a SpiceException will be thrown.

Version:
1.9
Author:
Christian Schaller - UA/PIRL

Constructor Summary
MroObservation.Builder(MroObservation.OrbitalData orbitalData)
          Creates a new MRO observation builder with the indicated orbital data model.
MroObservation.Builder(Target target, MroObservation.Orbit orbit, double et, double rollAngle)
          Creates a new MRO observation builder with the indicated target, ephemeris time, and roll angle.
 
Method Summary
 MroObservation build()
          Instantiates a new, immutable MRO observation from this builder.
 MroObservation.Builder comment(String comment)
          Sets the optional comment for this builder.
 MroObservation.Builder label(String label)
          Sets the optional label for this builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MroObservation.Builder

public MroObservation.Builder(Target target,
                              MroObservation.Orbit orbit,
                              double et,
                              double rollAngle)
Creates a new MRO observation builder with the indicated target, ephemeris time, and roll angle. The NAIF ID of the target's body must be 499, the NAIF ID code for Mars; if not, a IllegalArgumentException will be thrown.

The builder's observer is set to the shared MRO instance, which represents the MRO spacecraft in the IAU Mars body-fixed reference frame.

Parameters:
target - the target of the observation, which must be of Mars.
orbit - the observation's orbit.
et - the ephemeris time of the observation.
rollAngle - the roll angle in radians.
Throws:
NullPointerException - if the target or orbit is null.
IllegalArgumentException - if the target body is not Mars.

MroObservation.Builder

public MroObservation.Builder(MroObservation.OrbitalData orbitalData)
Creates a new MRO observation builder with the indicated orbital data model. The NAIF ID of the target's body must be 499, the NAIF ID code for Mars; if not, a IllegalArgumentException will be thrown.

The builder's observer is set to the shared MRO instance, which represents the MRO spacecraft in the IAU Mars body-fixed reference frame.

Parameters:
orbitalData - the orbital data model.
Throws:
NullPointerException - if the orbital data model is null.
IllegalArgumentException - if the orbital data target body is not Mars.
Method Detail

label

public MroObservation.Builder label(String label)
Sets the optional label for this builder. If null, the resulting MRO observation's label will be the empty string when the build() method is invoked.

Parameters:
label - the observation's optional label.
Returns:
the observation builder.

comment

public MroObservation.Builder comment(String comment)
Sets the optional comment for this builder. If null, the resulting MRO observation's comment will be the empty string when the build() method is invoked.

Parameters:
comment - the observation's optional comment.
Returns:
the observation builder.

build

public MroObservation build()
Instantiates a new, immutable MRO observation from this builder. If the builder's label or comment have been set to null, the observation's matching field will be the empty string, not null.

The observation's observer is set to the shared MRO instance, which represents the MRO spacecraft in the IAU Mars body-fixed reference frame.

Returns:
a new MRO observation.
Throws:
edu.asu.jmars.layer.obs.mro.SpiceException - if the SPICE kernel pool lacks the kernels needed to compute the observation's parameters.

HiRISE

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