- java.lang.Object
-
- spice.basic.Body
-
public class Body extends java.lang.Object
Class Body is used to represent identities of ephemeris objects.This class takes the place of integer ID codes and body names used by subroutine interfaces in SPICELIB and CSPICE. However, body names and codes are still used to construct Body objects: either a name or NAIF integer code must be supplied in order to construct a Body.
Additionally, this class provides API methods for retrieving certain data associated with ephemeris objects. In particular, PCK data associated with bodies, such as radii of triaxial ellipsoid shape models, once loaded into the kernel database, may be retrieved via methods of this class.
See the documentation for class
StateRecord
for a usage example.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.1.0 08-APR-2011 (NJB)
Removed spurious check for ID code 0 from method
getIDCode()
.Version 1.0.0 22-NOV-2009 (NJB)
-
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Test two Bodies for equality.int
getIDCode()
Return NAIF ID code associated with a Body.java.lang.String
getName()
Return name associated with a Body.double[]
getValues(java.lang.String item)
Return the double precision values of a kernel variable associated with this Body instance, where the kernel variable name has the formint
hashCode()
Return a hash code for this Body.This method overrides Object's hashcode() method.java.lang.String
toString()
Return body name in String.This method overrides Object's toString() method.
-
-
-
Field Detail
-
bodyID
private IDMap bodyID
-
-
Constructor Detail
-
Body
public Body(java.lang.String name) throws SpiceException
Construct a Body from a body name.- Parameters:
name
- String- Throws:
SpiceException
- exception
-
Body
public Body(int code) throws SpiceErrorException
Construct a Body from an integer code.- Parameters:
code
- int- Throws:
SpiceErrorException
- exception
-
Body
public Body(Body b) throws SpiceException
Construct a Body from another Body.This constructor creates a deep copy.- Parameters:
b
- Body- Throws:
SpiceException
- exception
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Test two Bodies for equality.The integer codes of the bodies are used for the comparison.
- Overrides:
equals
in classjava.lang.Object
- Returns:
- equals
-
hashCode
public int hashCode()
Return a hash code for this Body.This method overrides Object's hashcode() method.Note that this method can't throw a SpiceException.
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- hashCode
-
getIDCode
public int getIDCode() throws IDCodeNotFoundException, SpiceException
Return NAIF ID code associated with a Body.- Returns:
- IDCode
- Throws:
IDCodeNotFoundException
- exceptionSpiceException
- exception
-
getName
public java.lang.String getName() throws SpiceException
Return name associated with a Body.- Returns:
- name
- Throws:
SpiceException
- exception
-
toString
public java.lang.String toString()
Return body 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:
- name
-
getValues
public double[] getValues(java.lang.String item) throws SpiceException
Return the double precision values of a kernel variable associated with this Body instance, where the kernel variable name has the formBODY<ID code>_<item>
for exampleBODY599_RADII
The variable is specified by the "item" substring of the name. For example, for the radius variable above, the input string is
"RADII"
The item name is case-sensitive.
- Parameters:
item
- Variable and "item" substring, catenated with an underscore- Returns:
- retval
- Throws:
SpiceException
- exception
-
-