HiRISE

HiRISE.HiVali
Class Observation

java.lang.Object
  extended by HiRISE.HiVali.Observation
All Implemented Interfaces:
Cloneable, Comparable<Observation>

public class Observation
extends Object
implements Cloneable, Comparable<Observation>

Represents an Observation, which contains multiple channels.

Version:
1.16
Author:
guym

Field Summary
protected static String CRUISE_PATH_PREFIX
          Format for pathname of cruise phase Observation
static Pattern hexPattern
          Pattern to match Observation ID's in hexified strings
static String ID
          CVS ID
static Pattern idPattern
          Pattern to match Observation ID's in strings
protected static String ORBIT_PATH_PREFIX
          Format for pathname of in-orbit Observation
protected static String PRELAUNCH_PATH_PREFIX
          Format for pathname of pre-launch Observations
 
Constructor Summary
Observation(int id)
          Construct a new Observation with an Integer id.
Observation(String id)
          Construct a new Observation with the given ID String.
 
Method Summary
 void addChannel(Channel channel)
          Add a Channel to this Observation.
 Object clone()
          Clone this Observation
 int compareTo(Observation observation)
           
 boolean equals(Object object)
          Compare this Observation to another for equality.
 Set<String> getCCDs()
          Return the CCD names in this observation.
 Set<String> getCCDs(String filter)
          Return the CCDs for a given filter name in this observation.
 Set<Channel> getChannels()
          Get the Channels that have been added to this Observation.
 Set<Channel> getChannels(String ccd)
          Get the channel names within a given CCD for this observation.
 Set<String> getFilters()
          Return the filter names in this observation.
 String getHexID()
          Get the Hex form of this Observation's ID.
 String getID()
          Return the Observation ID (non-hex)
 String getPath()
          Get the relative pathname for this Observation as it will appear in a HiRISE archive volume.
static String getPhase(int orbit)
          Find an appropriate phase for a given orbit number.
 int hashCode()
          Get a hashcode for this Observation
static boolean isValid(String test)
          Quick low-overhead non-strict validation method.
static void main(String[] args)
          This command-line interface parses each argument into an observation.
static Observation parse(String text)
          Parse a String for an Observation ID value, returning it as a new Observation instance.
 void setDescription(String description)
          Set the description.
 void setTargetName(String targetName)
          Set the target name.
 String toString()
          Get the String representation of this Observation, including target and description if they have been set.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

public static final String ID
CVS ID

See Also:
Constant Field Values

ORBIT_PATH_PREFIX

protected static final String ORBIT_PATH_PREFIX
Format for pathname of in-orbit Observation

See Also:
Constant Field Values

CRUISE_PATH_PREFIX

protected static final String CRUISE_PATH_PREFIX
Format for pathname of cruise phase Observation

See Also:
Constant Field Values

PRELAUNCH_PATH_PREFIX

protected static final String PRELAUNCH_PATH_PREFIX
Format for pathname of pre-launch Observations

See Also:
Constant Field Values

idPattern

public static final Pattern idPattern
Pattern to match Observation ID's in strings


hexPattern

public static final Pattern hexPattern
Pattern to match Observation ID's in hexified strings

Constructor Detail

Observation

public Observation(String id)
            throws Invalid_Argument_Exception
Construct a new Observation with the given ID String.

Parameters:
id - String in the Observation_ID text form
Throws:
Invalid_Argument_Exception - Bad Observation ID string

Observation

public Observation(int id)
            throws Invalid_Argument_Exception
Construct a new Observation with an Integer id.

Parameters:
id - See HiRISE.libHiRISE.Observation_ID
Throws:
Invalid_Argument_Exception - Bad Observation ID value
Method Detail

setTargetName

public void setTargetName(String targetName)
Set the target name. This will be used in the toString method.

Parameters:
targetName - E.g. MARS, SKY, CAL

setDescription

public void setDescription(String description)
Set the description. This will be used in the toString method.

Parameters:
description - Short description, should be < 75 characters.

toString

public String toString()
Get the String representation of this Observation, including target and description if they have been set.

Overrides:
toString in class Object
Returns:
String title of Observation

parse

public static Observation parse(String text)
                         throws Invalid_Argument_Exception
Parse a String for an Observation ID value, returning it as a new Observation instance.

Parameters:
text - String containing an Observation ID
Returns:
new Observation
Throws:
Invalid_Argument_Exception - ID not found

getPhase

public static final String getPhase(int orbit)
Find an appropriate phase for a given orbit number. If zero, the phase will be CRU (cruise). This relies on libHiRISE Observation_ID being updated for each phase entered.

Parameters:
orbit - The orbit number
Returns:
Phase abbreviation

isValid

public static boolean isValid(String test)
Quick low-overhead non-strict validation method. Checks to see if the observation matches a regular expression.

Parameters:
test - The supposed ID
Returns:
True if it looks okay

getHexID

public String getHexID()
Get the Hex form of this Observation's ID.

Returns:
Hex Observation ID.

getID

public String getID()
Return the Observation ID (non-hex)

Returns:
Observation ID

getPath

public String getPath()
Get the relative pathname for this Observation as it will appear in a HiRISE archive volume. The relative pathname begins with the mission phase abbreviation, includes a folder name for the orbit or sequence, and concludes with the Observation ID. It does not include leading or trailing slashes.

Returns:
The pathname for this Observation

addChannel

public void addChannel(Channel channel)
Add a Channel to this Observation.

Parameters:
channel - Channel instance

getChannels

public Set<Channel> getChannels()
Get the Channels that have been added to this Observation.

Returns:
Set of Channels

clone

public final Object clone()
                   throws CloneNotSupportedException
Clone this Observation

Overrides:
clone in class Object
Returns:
New Observation instance with the same id
Throws:
CloneNotSupportedException

equals

public boolean equals(Object object)
Compare this Observation to another for equality.

Overrides:
equals in class Object
Returns:
True if both objects represent the same Observation

hashCode

public int hashCode()
Get a hashcode for this Observation

Overrides:
hashCode in class Object

compareTo

public int compareTo(Observation observation)
Specified by:
compareTo in interface Comparable<Observation>
See Also:
Comparable

getCCDs

public Set<String> getCCDs()
Return the CCD names in this observation.

Returns:
CCD names

getFilters

public Set<String> getFilters()
Return the filter names in this observation.

Returns:
Filter names. E.g. RED, BG, IR.

getCCDs

public Set<String> getCCDs(String filter)
Return the CCDs for a given filter name in this observation.

Parameters:
filter - Name of filter (RED, BG, IR)
Returns:
CCD names in this observatiobn for the filter

getChannels

public Set<Channel> getChannels(String ccd)
Get the channel names within a given CCD for this observation.

Parameters:
ccd - CCD Name, e.g. RED0_0
Returns:
The channels that are in this observation for the CCD name.

main

public static void main(String[] args)
This command-line interface parses each argument into an observation.

Parameters:
args - Series of strings containing observations

HiRISE

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