JNISpice
version 2.0.0

spice.basic
Class Body

java.lang.Object
  extended by 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)


Constructor Summary
Body(Body b)
          Construct a Body from another Body.
Body(int code)
          Construct a Body from an integer code.
Body(java.lang.String name)
          Construct a Body from a body name.
 
Method Summary
 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 form
 int hashCode()
          Return a hash code for this Body.
 java.lang.String toString()
          Return body name in String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Body

public Body(java.lang.String name)
     throws SpiceException
Construct a Body from a body name.

Throws:
SpiceException

Body

public Body(int code)
     throws SpiceErrorException
Construct a Body from an integer code.

Throws:
SpiceErrorException

Body

public Body(Body b)
     throws SpiceException
Construct a Body from another Body. This constructor creates a deep copy.

Throws:
SpiceException
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 class java.lang.Object

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 class java.lang.Object

getIDCode

public int getIDCode()
              throws IDCodeNotFoundException,
                     SpiceException
Return NAIF ID code associated with a Body.

Throws:
IDCodeNotFoundException
SpiceException

getName

public java.lang.String getName()
                         throws SpiceException
Return name associated with a Body.

Throws:
SpiceException

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 class java.lang.Object

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 form
      BODY<ID code>_<item>
   
for example
      BODY599_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.

Throws:
SpiceException

JNISpice
version 2.0.0

JNISpice Alpha Test Version 2.0.0 28-JAN-2017 (NJB)