- java.lang.Object
-
- spice.basic.Instrument
-
public class Instrument extends java.lang.Object
Class Instrument is used to represent identities of spacecraft structures or instruments.This class takes the place of integer ID codes and instrument names used by subroutine interfaces in SPICELIB and CSPICE. However, instrument names and codes are still used to construct Instrument objects: either a name or NAIF integer code must be supplied in order to construct an Instrument.
Version 2.0.0 26-DEC-2016 (NJB)
Functional change: the getName method now returns a copy of the String value used to create the instance, if the instance was created using a name rather than an ID code. Previously the name was generated by converting the instance's name field to an integer ID, then converting the ID back to a name.The copy constructor now uses the stored IDMap instance's deepCopy method, rather than converting the stored instance to an integer ID and using that to create a new instance.
Version 1.0.0 25-AUG-2009 (NJB)
-
-
Field Summary
Fields Modifier and Type Field Description private IDMap
instrumentID
-
Constructor Summary
Constructors Constructor Description Instrument(int code)
Construct an Instrument from an integer code.Instrument(java.lang.String name)
Construct an Instrument from a instrument name.Instrument(Instrument inst)
Construct an Instrument from another Instrument.
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Test two Instruments for equality.int
getIDCode()
Return NAIF ID code associated with an Instrument.java.lang.String
getName()
Return name associated with an Instrument.SCLK
getSCLK()
Return SCLK ID associated with an Instrument.The returned ID is that returned by the SPICE routine CKMETA.int
hashCode()
Return a hash code for this Instrument.This method overrides Object's hashcode() method.java.lang.String
toString()
Return instrument name in String.This method overrides Object's toString() method.
-
-
-
Field Detail
-
instrumentID
private IDMap instrumentID
-
-
Constructor Detail
-
Instrument
public Instrument(java.lang.String name) throws SpiceException
Construct an Instrument from a instrument name.- Parameters:
name
- String- Throws:
SpiceException
- exception exception
-
Instrument
public Instrument(int code) throws SpiceErrorException
Construct an Instrument from an integer code.- Parameters:
code
- int- Throws:
SpiceErrorException
- exception
-
Instrument
public Instrument(Instrument inst) throws SpiceException
Construct an Instrument from another Instrument.- Parameters:
inst
- Instrument- Throws:
SpiceException
- exception exception
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Test two Instruments for equality.The integer codes of the instruments are used for the comparison.
- Overrides:
equals
in classjava.lang.Object
- Returns:
- boolean
-
hashCode
public int hashCode()
Return a hash code for this Instrument.This method overrides Object's hashcode() method.Note that this method can't throw a SpiceException.
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- int
-
getIDCode
public int getIDCode() throws SpiceException
Return NAIF ID code associated with an Instrument.- Returns:
- int
- Throws:
SpiceException
- exception exception
-
getName
public java.lang.String getName() throws SpiceException
Return name associated with an Instrument.- Returns:
- String
- Throws:
SpiceException
- exception exception
-
toString
public java.lang.String toString()
Return instrument name in String.This method overrides Object's toString() method. Note that this method can't throw a SpiceException.- Overrides:
toString
in classjava.lang.Object
- Returns:
- String
-
getSCLK
public SCLK getSCLK() throws SpiceException
Return SCLK ID associated with an Instrument.The returned ID is that returned by the SPICE routine CKMETA.- Returns:
- SCLK
- Throws:
SpiceException
- exception exception
-
-