Module JNISpice
Package spice.basic

Class KernelPool


  • public class KernelPool
    extends java.lang.Object
    Class KernelPool supports access to the kernel pool data structure.

    Version 1.0.0 08-JAN-2010 (NJB)

    • Constructor Summary

      Constructors 
      Constructor Description
      KernelPool()  
    • Method Summary

      Modifier and Type Method Description
      private static int checkVar​(java.lang.String name, int dataType)
      Make sure a variable of a given name and data type exists.
      static boolean checkWatch​(java.lang.String agent)
      Determine whether any of the kernel variables associated with a specified agent have been updated.
      static void clear()
      Clear the kernel pool.
      static void delete​(java.lang.String name)
      Delete a variable from the kernel pool.
      static boolean exists​(java.lang.String name)
      Indicate whether a kernel variable of a given name exists.
      static boolean exists​(java.lang.String name, int dataType)
      Indicate whether a kernel variable of a given name and data type exists.
      static KernelVarDescriptor getAttributes​(java.lang.String name)
      Get the attributes of a kernel variable specified by name.
      static java.lang.String[] getCharacter​(java.lang.String name)
      Fetch a character kernel variable.
      static java.lang.String[] getCharacter​(java.lang.String name, int start, int room)
      Fetch a slice (a contiguous sequence of array elements) of a character kernel variable.
      static int getDataType​(java.lang.String name)
      Get the data type of a specified kernel variable.
      static double[] getDouble​(java.lang.String name)
      Fetch a double precision kernel variable.
      static double[] getDouble​(java.lang.String name, int start, int room)
      Fetch a slice (a contiguous sequence of array elements) of a double precision kernel variable.
      static int[] getInteger​(java.lang.String name)
      Fetch an integer kernel variable.
      static int[] getInteger​(java.lang.String name, int start, int room)
      Fetch a slice (a contiguous sequence of array elements) of an integer kernel variable.
      static java.lang.String[] getNames​(java.lang.String template)
      Retrieve an array containing all names of kernel variables that match a given template.
      static java.lang.String[] getNames​(java.lang.String template, int start, int room)
      Retrieve a slice of an array containing all names of kernel variables that match a given template.
      static int getParameter​(java.lang.String name)
      Return kernel pool size parameters specified by name.
      static int getSize​(java.lang.String name)
      Get the size of a specified kernel variable.
      static KernelVarStringComponent getStringComponent​(java.lang.String name, int nth, java.lang.String contin)
      Return a component of a string value from the kernel pool.
      static void load​(java.lang.String name)
      Load a text kernel into the kernel pool.
      static void loadFromBuffer​(java.lang.String[] cvals)
      Load into the kernel pool variables defined by "keyword=value" assignments in a string array.
      private static int mapDataType​(java.lang.String cspiceType)
      Map a CSPICE data type name to a KernelVarDescriptor int parameter.
      static void putCharacter​(java.lang.String name, java.lang.String[] values)
      Insert a character kernel variable into the kernel pool.
      static void putDouble​(java.lang.String name, double[] values)
      Insert a double precision kernel variable into the kernel pool.
      static void putInteger​(java.lang.String name, int[] values)
      Insert an integer kernel variable into the kernel pool.
      static void setWatch​(java.lang.String agent, java.lang.String[] names)
      Associate an agent with a set of kernel variables to be watched.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KernelPool

        public KernelPool()
    • Method Detail

      • mapDataType

        private static int mapDataType​(java.lang.String cspiceType)
                                throws SpiceException
        Map a CSPICE data type name to a KernelVarDescriptor int parameter.
        Throws:
        SpiceException
      • getAttributes

        public static KernelVarDescriptor getAttributes​(java.lang.String name)
                                                 throws SpiceException
        Get the attributes of a kernel variable specified by name.
        Parameters:
        name - String
        Returns:
        KernelVarDescriptor
        Throws:
        SpiceException - exception
      • exists

        public static boolean exists​(java.lang.String name,
                                     int dataType)
                              throws SpiceException
        Indicate whether a kernel variable of a given name and data type exists.

        Note that this functionality differs from that of the CSPICE routine `expool_c', which is restricted to numeric kernel variables.

        Parameters:
        name - String
        dataType - int
        Returns:
        boolean
        Throws:
        SpiceException - exception
      • exists

        public static boolean exists​(java.lang.String name)
                              throws SpiceException
        Indicate whether a kernel variable of a given name exists.

        Note that this functionality differs from that of the CSPICE routine `expool_c', which is restricted to numeric kernel variables.

        Parameters:
        name - String
        Returns:
        boolean
        Throws:
        SpiceException - exception
      • getStringComponent

        public static KernelVarStringComponent getStringComponent​(java.lang.String name,
                                                                  int nth,
                                                                  java.lang.String contin)
                                                           throws SpiceException
        Return a component of a string value from the kernel pool.

        This method is analgous to the CSPICE routine stpool_c.

        This method treats the string array associated with a character kernel variable as a sequence of components, where each component consists of a sequence of array elements connected by continuation characters.

        It is permissible for the input index not to correspond to an existing component. The returned KernelVarStringComponent instance contains a "found flag" that indicates whether the component exists.

        The indices of the components are zero-based.

        Parameters:
        name - String
        contin - String
        nth - int
        Returns:
        KernelVarStringComponent
        Throws:
        SpiceException - exception
      • putCharacter

        public static void putCharacter​(java.lang.String name,
                                        java.lang.String[] values)
                                 throws SpiceException
        Insert a character kernel variable into the kernel pool.
        Parameters:
        name - String
        values - String[]
        Throws:
        SpiceException - exception
      • putDouble

        public static void putDouble​(java.lang.String name,
                                     double[] values)
                              throws SpiceException
        Insert a double precision kernel variable into the kernel pool.
        Parameters:
        name - String
        values - double[]
        Throws:
        SpiceException - exception
      • putInteger

        public static void putInteger​(java.lang.String name,
                                      int[] values)
                               throws SpiceException
        Insert an integer kernel variable into the kernel pool.
        Parameters:
        name - String
        values - int[]
        Throws:
        SpiceException - exception
      • loadFromBuffer

        public static void loadFromBuffer​(java.lang.String[] cvals)
                                   throws SpiceException
        Load into the kernel pool variables defined by "keyword=value" assignments in a string array.
        Parameters:
        cvals - String[]
        Throws:
        SpiceException - exception
      • load

        public static void load​(java.lang.String name)
                         throws SpiceException
        Load a text kernel into the kernel pool.

        Caution: kernels loaded via this method are NOT loaded into the kernel database.

        Parameters:
        name - String
        Throws:
        SpiceException - exception
      • clear

        public static void clear()
                          throws SpiceException
        Clear the kernel pool.

        Caution: this routine should not be used together with the kernel database.

        Throws:
        SpiceException - exception
      • getParameter

        public static int getParameter​(java.lang.String name)
                                throws SpiceException
        Return kernel pool size parameters specified by name.
           name       is the name of a kernel pool size parameter.
                      The following parameters may be specified:
        
                      MAXVAR      is the maximum number of variables that the
                                  kernel pool may contain at any one time.
                                  MAXVAR should be a prime number.
        
                      MAXLEN      is the maximum length of the variable names
                                  that can be stored in the kernel pool.
        
                      MAXVAL      is the maximum number of distinct values that
                                  may belong to the variables in the kernel
                                  pool.  Each variable must have at least one
                                  value, and may have any number, so long as
                                  the total number does not exceed MAXVAL.
                                  MAXVAL must be at least as large as MAXVAR.
        
                      MXNOTE      is the maximum number of distinct
                                  variable-agents pairs that can be maintained
                                  by the kernel pool.  (A variable is "paired"
                                  with an agent, if that agent is to be
                                  notified whenever the variable is updated.)
        
                      MAXAGT      is the maximum number of agents that can be
                                  kept on the distribution list for
                                  notification of updates to kernel variables.
        
                      MAXCHR      is the maximum number of characters that can
                                  be stored in a component of a string valued
                                  kernel variable.
        
                      MAXLIN      is the maximum number of character strings
                                  that can be stored as data for kernel pool
                                  variables.
        
                      Note that the case of name is insignificant.  Embedded
                      blanks are also ignored.
           
        Parameters:
        name - String
        Returns:
        int
        Throws:
        SpiceException - exception
      • delete

        public static void delete​(java.lang.String name)
                           throws SpiceException
        Delete a variable from the kernel pool.
        Parameters:
        name - String
        Throws:
        SpiceException - exception
      • getNames

        public static java.lang.String[] getNames​(java.lang.String template)
                                           throws SpiceException
        Retrieve an array containing all names of kernel variables that match a given template.

        To obtain a slice of the array of variable names matching a template, see the method getNames( String template, int start, int room ).

        Parameters:
        template - String
        Returns:
        String[]
        Throws:
        SpiceException - exception
      • getNames

        public static java.lang.String[] getNames​(java.lang.String template,
                                                  int start,
                                                  int room)
                                           throws SpiceException
        Retrieve a slice of an array containing all names of kernel variables that match a given template.

        To obtain the full array of variable names matching a template, see the method getNames( String template).

        Parameters:
        template - String
        room - int
        start - int
        Returns:
        String[]
        Throws:
        SpiceException - exception
      • setWatch

        public static void setWatch​(java.lang.String agent,
                                    java.lang.String[] names)
                             throws SpiceException
        Associate an agent with a set of kernel variables to be watched.
        Parameters:
        agent - String
        names - String[]
        Throws:
        SpiceException - exception
      • checkWatch

        public static boolean checkWatch​(java.lang.String agent)
                                  throws SpiceException
        Determine whether any of the kernel variables associated with a specified agent have been updated.
        Parameters:
        agent - String
        Returns:
        boolean
        Throws:
        SpiceException - exception