dods.dap
Class Util

java.lang.Object
  extended bydods.dap.Util

class Util
extends Object

The Util class holds static methods used by this package.


Constructor Summary
(package private) Util()
           
 
Method Summary
(package private) static String escattr(String s)
          This function escapes non-printable characters and quotes.
(package private) static String[] sortedNames(Vector v)
          Takes a Vector of BaseTypes, retrieves their names into an array of Strings, and performs a Quick Sort on that array.
(package private) static void uniqueNames(Vector v, String varName, String typeName)
          Compares elements in a Vector of BaseTypes and throw a BadSemanticsException if there are any duplicate elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

Util()
Method Detail

uniqueNames

static void uniqueNames(Vector v,
                        String varName,
                        String typeName)
                 throws BadSemanticsException
Compares elements in a Vector of BaseTypes and throw a BadSemanticsException if there are any duplicate elements.

Parameters:
v - The Vector to check
varName - the name of the variable which called us
typeName - the type name of the variable which called us
Throws:
BadSemanticsException - if there are duplicate elements
IndexOutOfBoundsException - if size doesn't match the number of elements in the Enumeration

sortedNames

static String[] sortedNames(Vector v)
                     throws BadSemanticsException
Takes a Vector of BaseTypes, retrieves their names into an array of Strings, and performs a Quick Sort on that array.

Parameters:
v - The Vector to check
Returns:
a sorted array of String
Throws:
BadSemanticsException - if there is an element with no name

escattr

static String escattr(String s)
This function escapes non-printable characters and quotes. This is used to make printVal output DString data in the same way as the C++ version. Since Java supports Unicode, this will need to be altered if it's desired to print DString as UTF-8 or some other character encoding.

Parameters:
s - the input String.
Returns:
the escaped String.