// Test if a description exists.


// Get a vector with all column names.


//# Rename a column.


//# Test if the table is writable.


//# Add rows.


// Construct the iterator on a ConcatRows object for the given row range.


// BaseTableIterator is the base class for the table iterators.
// It is a letter class of the envelope TableIterator.
//
// BaseTableIterator iterates by sorting the table in the required
// order and then creating a RefTable for each step containing the row
// numbers of the rows for that iteration step.


// When description is empty, TableRecord is not fixed.


//# This is a very simple implementation.
//# However, it does not need to be more fancy, since an array operation
//# is already much more expensive than the virtual function calls
//# involved in each loop iteration.


// Return Table and name of last part.


//# Write a concatenate table into a file.


//# Read a concatenate table from a file and open the associated tables.


//# Read description and #rows.


//# Create a ConcatColumn object for all columns in the description.
//# Insert it with the name in the column map.


//# Read/write the column.
//# Its data will be read/written by the appropriate storage manager.
//# It was felt that putstart takes too much space, so therefore
//# the version is put "manually".


//# By default all functions throw an exception
//# to ensure they are called correctly.


//# Open the table file and read it in if necessary.


// NOTE: When changing this function because of new Table versions, also change
// TableUtil::getLayout !!!!!


// Check if the table data has changed.


//# Sort on a single column.
//# This is converted to a sort on a vector of column names.


//# Sort on multiple columns, where a global order is given.
//# This is converted to a sort with mixed orders.


//# Sort on multiple columns and orders.


//# Create an expression node to handle a keyword.
//# The code to handle this is in TableExprNode, because there the
//# differentation between data types is being made.


//# Test if table exists and is readable.


//# Test if table exists and is writable.


//#Begin namespace casacore


//# Remove a column.
//# Let the column first act upon its removal.


//# Rename a column in the set.
//# Let all columns act upon the rename (in case they refer to the old name).


//# Check recursevily if the descriptions of all subtables are known.


//# Add another column set.
//# Duplicates are not allowed, because renaming or skipping them
//# may disturb the virtual columns referencing others.
//# Add each column in its turn.


//# Put the object.


//# Get the object.


//# Put the object.
//# The data is read by the ctor taking AipsIO.
//# It was felt that putstart takes too much space, so therefore
//# the version is put "manually".


//# Show the column.


//# Create a column object from the description.


//# First get the column name and use that as key.


//# Add rows to all data managers.


//# Remove a row from all data managers.


//# Initialize rows.


//# Find the data manager with the given sequence number.


//# It was felt that putstart takes too much space, so therefore
//# the version is put "manually".


//# Make a new object.


//# Clone this column description to another.


//# Get the table description.
//# Throw exception if not there.


//# Reread the table description if referenced by name.


//# Create the data manager column for this column.
//# The shape of a fixed shape array has to be defined in advance.


//# Get or put the column by iterating through the array and getting the
//# column array for each row.


//# Check if the array shape is set correctly.
//# It is only possible for non-FixedShape arrays.
//# Its dimensionality must match the possible #dim in the column description.


// Show the column.


// Dimensionality can only be changed if not set yet.


//# By default no table description gets returned.


//# Put the XXXColumnDesc object.
//# First the base class variables are written, then the virtual
//# function putDesc is called to write the specific variables.
//# Note that the data is read back by the ctor taking AipsIO.
//# It was felt that putstart takes too much space, so therefore
//# the version is put "manually".


//# End writing a table file.


//# Prepare for copying or renaming a table.


//# Rename a table.


//# A column is writable if the table and column are writable.


//# Get a vector of row numbers.


//# Sort a table.


//# Do the actual sort.


// Do the row selection.


//# And (intersect) 2 tables and return a new table.


//# Or (union) 2 tables and return a new table.


//# Subtract (difference) 2 tables and return a new table.


//# Xor 2 tables and return a new table.


//# Negate a table (i.e. take all rows from the root not in table).


//# Check if both tables have the same root.


//# Get the rownrs from the reference table.
//# Note that rowStorage() throws an exception if it is not a RefTable.
//# Sort them if not in row order.


//# This is the implementation of the class TabPath.


//# Adjust the input rownrs to the actual rownrs in the root table.


//# Write a reference table into a file.


//# Read a reference table from a file and read the associated table.


//# Build the name map from the description.
//# Old and new name are (initially) equal.
//# Make RefColumn objects and initialize TableInfo.


//# Create a RefColumn object for all columns in the description.
//# Insert it with the name in the column map.


//# Add column to this object for an addColumn.


//# Add a row number of the root table.


//# Add a row number range of the root table.


//# Set exact number of rows.


//# We cannot simply return colMap_p.getVal(columnIndex), because the order of
//# the columns in the description is important. So first get the column
//# name and use that as key.


//# Convert a vector of row numbers to row numbers in this table.


// And 2 index arrays, which are both in ascending order.


// Or 2 index arrays, which are both in ascending order.


// Subtract 2 index arrays, which are both in ascending order.


// Xor 2 index arrays, which are both in ascending order.


// Negate a table.


// Get the column info for output.


// <summary>
// Test program for class tConcatTable
// </summary>


// Remove the dirname from the table name in an error message.


// <summary>
// Test program for class RefRows.
// </summary>


// Create a table and various subtables.


// <summary>
// Test program for the ScalarRecordColumn classes
// </summary>


// Create the table.


// Create tables in a subdirectory which is created first.


// <summary>
// Test program for the TableLock class.
// </summary>


// This program tests the class TableInfo.
// The results are written to stdout. The script executing this program,
// compares the results with the reference output file.


// <summary>
// Test program for RefTable::addColumn
// </summary>


// Check if all rows are equal.


// Update some rows by setting them to False.


// <summary>
// Test program for class ConcatRows.
// </summary>


// Remove some keywords/columns.
// Do some tests of the options for the constructor.


// Do some more erroneous constructions.


// This function checks if a field name is correct.
// A name has to be > 0 characters and start with an uppercase.
// The extra argument should not be 10.


// This function is doing define's and assign's in several ways.
// Many of them are incorrect and should result in an exception.
// TpArrayString2 has a fixed shape, while TpArrayString3's shape is variable.
// Note that assign always requires a matching shape, while a define
// only requires a matching shape for a fixed shape.
// It checks if the value is correct after each define/assign.


// Check if the values in the record and subrecord are correct.
// The number of fields and the value of the Int fields can vary,
// so they are given as arguments.


// Test Table specific things.


// Define the callback for handling (scratch) tables.


//# Test deletion of rows, array of Strings, and some more.


// This function times how fast it can read data back.


// This program tests concurrent access to tables.
// It is doing this by running the program simultaneously in different
// processes and with different options.
// It can be run as follows:
//   tTableLockSync_2 option inspection_interval wait_period get_put nrrow/wait
//        option               1=Permanent 2=PermanentWait 3=Auto 4=User
//        inspection_interval  only meaningful for Auto (in seconds)
//        wait_period          period to sleep before next get or put
//        get_put              0=get 1=put
//        nrrow                #rows to put


// This program and script tTableTrace.run test the class TableTrace.


// Create the description of the table and its subtable.
// Define some defaults (as scalar and array) to test if they
// are filled in correctly when a row is added to a table.


// Write data into the table.


/*
//This implementation is flawed.  It only works if you have  removed
//one axis.  I think you need to specify coordinate and axis in coordinate

Bool CoordinateSystem::worldReplacementValue (Double& replacement, uInt axis) const
{
   Int coordinate = -1;
   Int axisInCoordinate = -1;
   if (checkWorldReplacementAxis(coordinate, axisInCoordinate, axis)) {
      replacement = world_replacement_values_p[coordinate]->operator()(axisInCoordinate);
      return True;
   }
//
   return False;
}

Bool CoordinateSystem::setWorldReplacementValue (uInt axis, Double replacement)
{
   Int coordinate = -1;
   Int axisInCoordinate = -1;
   if (checkWorldReplacementAxis(coordinate, axisInCoordinate, axis)) {
      world_replacement_values_p[coordinate]->operator()(axisInCoordinate) = replacement;
      return True;
   }
//
   return False;
}

Bool CoordinateSystem::pixelReplacementValue (Double& replacement, uInt axis) const
{
   Int coordinate = -1;
   Int axisInCoordinate = -1;
   if (checkPixelReplacementAxis(coordinate, axisInCoordinate, axis)) {
      replacement = pixel_replacement_values_p[coordinate]->operator()(axisInCoordinate);
      return True;
   }
//
   return False;
}

Bool CoordinateSystem::setPixelReplacementValue (uInt axis, Double replacement)
{
   Int coordinate = -1;
   Int axisInCoordinate = -1;
   if (checkPixelReplacementAxis(coordinate, axisInCoordinate, axis)) {
      pixel_replacement_values_p[coordinate]->operator()(axisInCoordinate) = replacement;
      return True;
   }
//
   return False;
}
*/


/*
Bool CoordinateSystem::checkWorldReplacementAxis(Int& coordinate,
                                                 Int& axisInCoordinate,
                                                 uInt axis) const
{

// Find number of (unremoved) world axes

    const uInt nC = nCoordinates();
    uInt nWorld = 0;
    for (uInt i=0; i<nC; i++) {
       nWorld += world_maps_p[i]->nelements();
    }

// Check axis

    if (axis >= nWorld) {
       ostringstream oss;
       oss << "Illegal removal world axis number (" << axis << "), max is ("
           << nWorld << ")" << endl;
       set_error (String(oss));
       return False;
    }

// Find coordinate and axis in coordinate

    coordinate = -1;
    axisInCoordinate = -1;
    Int value;
    for (uInt i=0; i<nC; i++) {
	const uInt na = world_maps_p[i]->nelements();
	for (uInt j=0; j<na; j++) {
           value = world_maps_p[i]->operator[](j);       // We stored -1 * (axis + 1) when we removed it
           if (value < 0) {
              value = -1 * (value + 1);
              if (value == Int(axis)) {
		coordinate = i;
		axisInCoordinate = j;
                break;
              }
           }
	}
    }

// Check

    if (coordinate==-1 || axisInCoordinate==-1) {
       ostringstream oss;
       oss << "Cannot find world axis " << axis << endl;
       set_error (String(oss));
       return False;
    }
//
    return True;
}

Bool CoordinateSystem::checkPixelReplacementAxis(Int& coordinate,
                                                 Int& axisInCoordinate,
                                                 uInt axis) const
{

// Find number of (unremoved) pixel axes

    const uInt nC = nCoordinates();
    uInt nPixel = 0;
    for (uInt i=0; i<nC; i++) {
       nPixel += pixel_maps_p[i]->nelements();
    }

// Check axis

    if (axis >= nPixel) {
       ostringstream oss;
       oss << "Illegal removal pixel axis number (" << axis << "), max is ("
           << nPixel << ")" << endl;
       set_error (String(oss));
       return False;
    }

// Find coordinate and axis in coordinate for removed axis

    coordinate = -1;
    axisInCoordinate = -1;
    Int value;
    for (uInt i=0; i<nC; i++) {
	const uInt na = pixel_maps_p[i]->nelements();
	for (uInt j=0; j<na; j++) {
           value = pixel_maps_p[i]->operator[](j);       // We stored -1 * (axis + 1) when we removed it
           if (value < 0) {
              value = -1 * (value + 1);
              if (value == Int(axis)) {
                 coordinate = i;
                 axisInCoordinate = j;
                 break;
              }
           }
	}
    }

// Check

    if (coordinate==-1 || axisInCoordinate==-1) {
       ostringstream oss;
       oss << "Cannot find removed pixel axis " << axis << endl;
       set_error (String(oss));
       return False;
    }
//
    return True;
}

*/


// These world abs/rel functions are independent of the conversion direction type.


// Helper functions to help us interface to WCS


//static Bool stringtoSpecType(SpecType &specType, const String &stypeString) const;
//SpectralCoordinate::SpecType SpectralCoordinate::stringtoSpecType(String stypeString)


// Does everything except set the units vector, which must be done in the derived class.


// after = factor * before


//#endif // WCSLIB_VERSION >= 5.7


// begin namespace casa


// Get the OpenMPI rank from the current process.
// This assumes that the MPI library implementation is openMPI.
// If a program is started without mpirun, LogOrigin will print nothing
// for node_p. If it is started with mpirun, each instance
// running on an MPI server will print its rank at the LogOrigin


// The callback function for function linkNames.


//
// The constructor does nothing more but read the users environment
// and add appropriate things to the linked list of Param`s
// This can be turned off by overriding the default `init' argument.
//


// CreatePar() is the workhorse function, it is a private member function


//
// Move to the current named Parameter; return 0 if none found
// A value >= 1 is the index (not used in K_ stuff)
//


//      Show current key=val pairs, with program name


// Swallow arguments, setting keyword=value pairs appropriately from command
// line arguments in either "keyword=value" or "-keyword value" format. Argv[0]
// is assumed to be the program name.


// modify and other misc function


//#Begin namespace casa


//setMemoryOptions uses compiler defines to set the
// memory options if needed.  It is intended to be
// only called at the start of a program.  Use
// setMemoryOption to tweak the memory options elsewhere.


/* Use spin loop to initialize global lock */


/* Return segment holding given address */


/* Return true if segment contains a segment link */


/* support for mallopt */


/* Check properties of top chunk */


/* Check properties of (inuse) mmapped chunks */


/* Check properties of inuse chunks */


/* Check properties of free chunks */


/* Check properties of malloced chunks at the point they are malloced */


/* Check a tree and its subtrees.  */


/*  Check all the chunks in a treebin.  */


/*  Check all the chunks in a smallbin.  */


/* Find x in a bin. Used in other check functions. */


/* Traverse each chunk and check it; return total */


/* Check all properties of malloc_state. */


/* Malloc using mmap */


/* Realloc using mmap */


/* Initialize top chunk and its size */


/* Initialize bins for a new mstate that is otherwise zeroed out */


/* default corruption action */


/* Allocate chunk and prepend remainder with chunk in successor base. */


/* Add a segment to hold a new noncontiguous region */


/* Unmap and unlink any mmapped segments that don't contain used chunks */


/* allocate a large request from the best fitting chunk in a treebin */


/* allocate a small request from the best fitting chunk in a treebin */


/*
  mspace versions of routines are near-clones of the global
  versions. This is not so nice but better than the alternatives.
*/


// IBM has format  SEEEEEEE FFFFFFFF ...
// The exponent has base 16. Fraction has no hidden bits.
// IEEE has format SEEEEEEE EFFFFFFF ...
// The exponent has base 2. Fraction has a hidden bit (i.e. a 1 before first F)


// IBM has format  SEEEEEEE FFFFFFFF ...
// The exponent has base 16. Fraction has no hidden bits.
// IEEE has format SEEEEEEE EEEEFFFF ...
// The exponent has base 2. Fraction has a hidden bit (i.e. a 1 before first F)


// Vector<String> Directory::find (const String& fileName,
// 				Bool followSymLinks) const
// {
// //#//    return find ('^' + Regex::fromString (fileName) + '$', followSymLinks);
//     return find (Regex (Regex::fromString (fileName)), followSymLinks);
// }


// VAX has almost identical format to IEEE (but no NaN)
// which is SEEEEEEE EFFFFFFF ...
// The VAX exponent is 2 higher.
// The VAX byte order is b1b0b3b2 (Big-endian IEEE has b0b1b2b3).


// Used internally here to determine if Daylight Savings Time (Summer
// Time) is currently active.  1 is True, 0 False.


// Modcomp has one more bit in the exponent than IEEE and because it does not
// have an implicit bit two less bits in the Mantissa. It does not have any
// special numbers like NaN or Infinity. The Modcomp is big-endian (like Sun's)


// This program tests the class RegularFile.
// The results are written to stdout. The script executing this program,
// compares the results with the reference output file.
// <p>
// When an argument is given, no exceptions will be thrown.
// This can be used to check if no memory leaks occur in normal operation.


// This program tests various ways to convert bits to Bools and vice-versa.


// Check optimized conversions.


// This program tests the class DirectoryIterator.
// The results are written to stdout. The script executing this program,
// compares the results with the reference output file.
// <p>
// When an argument is given, no exceptions will be thrown.
// This can be used to check if no memory leaks occur in normal operation.


// This program tests the class SymLink.
// The results are written to stdout. The script executing this program,
// compares the results with the reference output file.
// <p>
// When an argument is given, no exceptions will be thrown.
// This can be used to check if no memory leaks occur in normal operation.


// This program tests the class Directory.
// The results are written to stdout. The script executing this program,
// compares the results with the reference output file.
// <p>
// When an argument is given, no exceptions will be thrown.
// This can be used to check if no memory leaks occur in normal operation.


// Check if all conversion definitions are set correctly.
// It write error messages to cout and exits (with status 1)
// when errors are found.


// This program tests the data conversion classes.


// This program test the VAX conversion functions.


// This program tests the class File.
// The results are written to stdout. The script executing this program,
// compares the results with the reference output file.
// <p>
// When an argument is given, no exceptions will be thrown.
// This can be used to check if no memory leaks occur in normal operation.


// This program tests the class Path.
// The results are written to stdout. The script executing this program,
// compares the results with the reference output file.
// <p>
// When an argument is given, no exceptions will be thrown.
// This can be used to check if no memory leaks occur in normal operation.


// This program tests the Modcomp conversion functions.


// Exception which causes an abort instead of continuing


//# Get the size of the data type.


//# Get the canonical size of the data type.


//# Test if a data type can be promoted to another.
//# Note that the cases fall through.


//# Get the comparison routine.


//# Get the comparison object.


// Construct the class.
// Allocate a first buffer of bufsz (default 4096) bytes.
// If we do not allocate it here, it will be done by newbuf.
// However, then we may get a huge buffer, which may be not so nice.
// bufsz may be sufficient for many purposes.


// Start the buffers by resetting the current buffer.


// Get a new buffer


// Start for the next function.
// Store used length of last block used.


//#Begin casa namespace


// Make sure the return value for a non-match is the same
// for 32 and 64 bit machines.


// First do some simple Regex things.


// Sort two arrays using Sort or in a Combined way.
// It resembles sorting on baselines.


// to be called using types for which an exception from asScalar is expected


// Test the output operator.


// Test a Regex in parallel.


// Test case-insensitive sort.


// Test real interval sort.


// Test other interval.


// This program test the class Sort.
// It sorts some data in ascending and/or descending order.
// The results are written to stdout. A script executing this program,
// compares the output with a reference output file.


// Test with 1 and 2 keys, because 1 key is short-circuited to GenSort.


// This is the function that does most of the work. It is pretty slow for
// large maps, but no real problem.


// Note that the parameters should not be references!


// General usage routines


//#  --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
//#  The following functions are designed to replace (in two passes)
//#  the following regular expression operations...
//#  (written by Darrell Schiebel)
//#  --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
//#  static Regex f1("\\*\\*"); static String sf1("");
//#  static Regex f2("\\^"); static String sf2("");
//#  static Regex f3("\\*"); static String sf3(".");
//#  static Regex f4(" */ *"); static String sf4("/");
//#  static Regex f5("//"); static String sf5(".");
//#  static Regex f6("\\.*/\\.*"); static String sf6("/");
//#  static Regex sp(" +"); static String ssp(".");
//#  static Regex pd("\\.+"); static String spd(".");
//#  static Regex bp("^\\.+"); static String sbp("");
//#  static Regex ep("\\.+$"); static String ebp("");
//#  ...
//#  uName.gsub(f1, sf1);
//#  uName.gsub(f2, sf2);
//#  uName.gsub(f3, sf3);
//#  uName.gsub(f4, sf4);
//#  uName.gsub(f5, sf5);
//#  uName.gsub(f6, sf6);
//#  uName.gsub(sp, ssp);
//#  uName.gsub(pd, spd);
//#  uName.gsub(bp, sbp);
//#  uName.gsub(ep, ebp);
//#  --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---


//# Member functions


// Initialise the maps


// This probably isn't of interest to normal users. It returns the "volume" of
// an array (i.e. "nelements").


// This probably isn't of interest to normal users. Given a decimated
// array with a non-zero origin, what is the linear index into storage.
// Here we assume that the Shape is the original length, i.e. has INC
// in it.


// the vector dot/scalar/inner product


// The infinity norm of a matrix


// the infinite norm of a matrix


// The one norm of a matrix


// Various vector tests


// ~IPosition tested implicitly
// at end of block


// Testing Vector math and logicals


// This test-case is no longer valid: deallocation of an array that's
// allocated with new[] is not supported in Array2.
/*
BOOST_AUTO_TEST_CASE( life_cycle_2 )
{
  IPosition const shape(2, 2, 3);
  LifecycleChecker::clear();
  LifecycleChecker *ptr = new LifecycleChecker[shape.product()];
  {
    Array<LifecycleChecker> a;
    a.takeStorage(shape, ptr, TAKE_OVER);
    a.resize(IPosition(2, 3, 3), true);
  }
  BOOST_CHECK_EQUAL(LifecycleChecker::ctor_count, LifecycleChecker::dtor_count);
}
*/


/*
BOOST_AUTO_TEST_CASE( life_cycle_5 )
{
  IPosition const shape(2, 2, 3);
  LifecycleChecker::clear();
  LifecycleChecker *ptr = new LifecycleChecker[shape.product()];
  {
      Array<LifecycleChecker> a(shape, ptr, TAKE_OVER);
  }
  BOOST_CHECK_EQUAL(LifecycleChecker::ctor_count, LifecycleChecker::dtor_count);
}
*/


/*
BOOST_AUTO_TEST_CASE( life_cycle_13 )
{
  IPosition const shape(2, 2, 3);
  LifecycleChecker::clear();
  {
    // no longer supported in Array2
    // Array<LifecycleChecker> a(shape, ArrayInitPolicies::NO_INIT);
  }
  BOOST_CHECK(LifecycleChecker::ctor_count == 0);
  BOOST_CHECK(LifecycleChecker::dtor_count == (size_t)shape.product());
}*/


/*
BOOST_AUTO_TEST_CASE( life_cycle_15 )
{
  IPosition const shape(2, 2, 3);
  {
    Array<LifecycleChecker> a;
    LifecycleChecker::clear();
    // no longer supported in Array2
    // a.resize(shape, false, ArrayInitPolicies::NO_INIT);
  }
  BOOST_CHECK(LifecycleChecker::ctor_count == 0);
  BOOST_CHECK(LifecycleChecker::dtor_count == (size_t )shape.product());
}*/


// Various further tests (coming from 'main()')


// Check that an array contains data.


// Check that the virtual functions throw an exception for a base object.


// Check if the values in the array are correct.


// Test if objects of the base class behave fine.


// Now test if it works fine for a real array.


// Check if all diagonals using a given axis are correct.


/*
  MultiFile keeps a map of blocks in each individual file to the
  blocks in the overall file.
  This map is kept in the MultiFile header. If too large, the
  remainder is written at the end of the file. A possible problem
  with this scheme is that when the MultiFile gets extended, the new
  blocks overwrite the remainder of the map if the blocks occupied
  by the remainder are not counted. This leads to file corruption
  in case the program or system crashes.
  In order to write the remainder in a robust way, the header keeps
  two lists of continuation blocks which are used alternately. The
  first header block (written at offset 0) tells which continuation
  block is used. It is written after the continuation blocks, so
  there is always a valid header.
  In case the header shrinks, it is possible less continuation blocks
  are needed. The superfluous blocks are kept and will be used when the
  header grows again. If not growing, they are 'lost' which is no problem
  as there are far less header blocks than data blocks.
  A potential problem is that if data blocks get removed at the end, the
  file cannot be truncated because a continuation block is stored after
  those data blocks. In the future it might be wise to move such a block
  upward. However, in practice this will hardly ever occur. Note that
  the header size implicitly tells how many continuation blocks are
  actually used.
  Another small problem is that new continuation blocks are put at the end
  of the file and are not taken from the free list to avoid that the free
  list needs to be serialized again. Again, in practice this is hardly a
  problem because data blocks will be removed very seldomly.
 */


// Only open if not already open.


// Close the file and delete filebuf buffer space.
// Delete the file if required.


// Release a lock.


// The toLocal and fromLocal function.
// These versions copy the buffer in a reversed way.


// The toLocal and fromLocal function.
// These versions do a straightforward copy (much faster).


// Build a file.


// Near functions
// Note: max() cannot be used from Math.h until it is derived from <math>
// Note: abs() not defined in SGI
//


// Construct the object from the value in a record.


// When description is empty, Record structure is variable.


//      See Simulation, Modelling & Analysis by Law & Kelton, pp259
//      This is the ``polar'' method.
//      We actually generate two IID normal distribution variables.
//      We cache the one & return the other.


//      See Simulation, Modelling & Analysis by Law & Kelton, pp259
//      This is the ``polar'' method.


// Test the non-cache functions.


// currently only supports a single region contained within
// the file.  It would be nice to be able to have multiple
// regions in a single file.


/*************************************************************
   **  Make BOX region routines                               **
   *************************************************************/


/*************************************************************
   **  Make POLYGON routines                                  **
   *************************************************************/


/*************************************************************
   **  DIFFERENCE routines                                    **
   **  Note, that the we could add support for doing the      **
   **  difference of multiple regions since the support       **
   **  exists underneath.                                     **
   *************************************************************/


/*************************************************************
   **  CONCAT a box to a region(s) routines                   **
   *************************************************************/


/*************************************************************
   ** Regions from file/table  routines                       **
   *************************************************************/


// Copy constructor (reference semantics)


// Clear the global info.


//# name space casa begins


// Write and check the image.


// Stream, unstream, and check the image.


// Remove the dirname from the file name in an error message.


//# This function simulates the same function in DOImage2.cc.


//# This function is a copy of the expr function in DOImage2.cc, which
//# failed mysteriously on sneffels (RedHat Linux 5.2) in April 1999.


// This test program was created because of a problem detected in the
// CASA Imager::clone function. It created an image without writing/flushing
// it, which worked well until the TSM changes made to support mmap.
// It was fixed in the TSM (for all modes) and tested in tTableEmpty and here.


// Construct from the IPosition's defining the bottom-left and
// top-right corner of the box.


// Truncate start such that edge is taken if very close to a pixel point.
// Take care of fact that Float is not always exact.


// Truncate end such that edge is taken if very close to a pixel point.


// Check if the coordinates of this and that conform.


// Specify the size of the Lattice. Assume a full size sub-Lattice.


// Specify a Lattice and define a sub-Lattice within it.


// Copy constructor. This uses copy semantics.


// function to change the shape of the Lattice. Resets the sub-Lattice to
// fullsize.


// Returns the length of the requested axis in the parent Lattice


// Returns the length of the requested axis in the sub-Lattice


// function to return the increments along the requested axis of the
// Lattice.


// function to return the offset on the specified axes between the
// sub-Lattice and the parent one.


// Revert from a sub-Lattice description back to the main Lattice. This is
// the only way to "increase" the the size of the sub-Lattice used by the
// LatticeIndexer.


// function which increments (incr=True) or decrements (incr=False) the
// cursor position (the first IPosition argument) by a cursor shape (the
// second IPosition argument), tiling to the next/previous axis if
// necessary.  The path of movement is based upon the third IPosition
// argument (a cursor heading) that is zero-based e.g. IPosition(3,0,2,1)
// implies starting movement along the x-axis, then the z-axis, and then
// the y-axis.  Returns a value of False if the beginning/end of the
// sub-Lattice is reached. The cursorPosition is relative to the origin of
// the sub-Lattice. To get its location relative to the main Lattice use
// the absolutePosition() function.


// function which returns a value of True if the IPosition argument
// is within the sub-Lattice.  Returns False if the IPosition argument is
// outside the sub-Lattice or if the argument doesn't conform to the
// data members.


// function which subsections a LatticeIndexer.  The argument IPositions
// specify "bottom left" and "upper right" corners and axis increments
// (which default to one).  The origins are cumulative. i.e. specifying a
// blc of (2,2), and then (1,1) results in the sub-Lattice having an
// origin at pixel (3,3) in the parent Lattice. Similarly the increment is
// cumulative, i.e. an increment of 2 on top of an increment of 3 results
// in a total increment of 6. This function can only decrease the size of
// the sub-Lattice (i.e. blc >= 0, and trc <= shape(), and inc >= 1). The
// fullSize() function should be used to revert back to the maximum
// possible Lattice size.  Also note that the trc might not be used if an
// integral number of increments does not end on the trc (in which case
// the last position below the trc will be used).


// function which returns an IPosition in the parent Lattice given an
// IPostion in the sub-Lattice.  Accounting is taken of any offsets and
// increments caused by subSectioning. No checks are made to ensure the
// supplied IPosition or the returned one are within the bounds of the
// Lattice(s).


// the copy constructor which uses copy semantics.


// Function to specify a "section" of the Lattice to Navigate over. A
// section is defined in terms of the Bottom Left Corner (blc), Top Right
// Corner (trc), and step size (inc), on ALL of its axes, including
// degenerate axes.


// Return the bottom left hand corner of the current sub-Lattice. If no
// sub-Lattice has been defined return blc=0


// Return the top right hand corner of the current sub-Lattice. If no
// sub-Lattice has been defined return trc=latticeShape-1


// Return the step increment between the current sub-Lattice and the main
// Lattice. If no sub-Lattice has been defined return inc=1


// Function to specify a "section" of the Lattice to Navigate over. The step
// increment is assumed to be one.


// Function which returns the current position of the end of the cursor
// relative to the main Lattice.


// Function which returns the current position of the end of the cursor
// relative to the sub Lattice.


// check if the cursor shape is an sub-multiple of the Lattice shape


// This program tests concurrent access to lattices.


// This program tests the class TiledShape.
// The user has the option to enter an interactive session


// Create the lattice cube.


// Call back function


//****** Test on complex fitting ************


// verify the MedianSlider values


// Only private functions hereafter. They do not need to be locked.


// Double version with two identicals and mask


// Determine if the solution has small enough residual vector.


//# Private member functions


//# Conversion routines


// Magnetic field (IGRF) function


// Diurnal Aberration factor


// Position related routines


// Polar motion related routines


// Helper function for getTable().


// Make uvw from baselines


// Expand positions to baselines


// Refmans says thsi is advanced use (Wim) only, so we ignore it
/*
  // addev
  case 10: {
    Parameter<MeasureHolder> val(parameters, valName,
				 ParameterSet::In);
    Parameter<Array<Quantum<Double> > > returnval(parameters, returnvalName,
						  ParameterSet::Out);
    if (runMethod) {
      Vector<Quantum<Double> > res =
	val().asMeasure().getData()->getXRecordValue();
      returnval().resize(IPosition());
      returnval() = res;
    }
  }
  break;
*/


// Fill RotMat with Fortran Matrix


// Check rotation angle around arbitrary axis between two matrices (mas)


// Check existence of and fill properties


// Expand multiple fields and fill properties and types


// Create type related lists and maps


// Create table properties


// Match a string (non-case sensitive) to a list


// Get now as MJD


// Get version string


// Split line (at pattern) into vector of strings.


// Make Double from string


// Make Int from string


//*************************************************************************//
// Test if table tnam has to be updated. tprop are the table properties;
// inVal the switches


//*************************************************************************//
// Open readable table


//*************************************************************************//
// Create new table if 'renew' or if not exists; else open existing.
// tnam is full path name; td is table descriptor;
// vs is initial version (normally 1.0);
// title is description; type is short name


//*************************************************************************//
// Close table tab (with name tnam) and update version (if vsup>0);
// the version date (if timup True);
// and show the table time statistics (if timshow True).


//*************************************************************************//
// Get last MJD in table


//*************************************************************************//
// Obtain VS_DATE from table


// Read data from ascii input file. The table (for reference only) is tnam;
// input file is inpath; out is vector of file lines.


//*************************************************************************//
// Write the measuresdata rc file.


// Fill geodetic/TAI_UTC table


// Fill eop table


// Fill predict table


// Fill geodetic/IGRF table


// DE ascii files are for 20 year intervals


//# Note that the most general exception must be registered first.


// Check if the object is an array scalar and return its type.


// A bit similar to PycBasicData.h


//========================================================================================
// wrap the constructor with cfitsio of NASA. GYL


//======================================================================================
// To see what to do with this constructor. we need a m_fptr for io operation.
// Can we get the file name from the file descriptor fd? No. However, this constructor
// is only used for standard io. So we do not have to worry about it.


//======================================================================================
// close fits file with cfitsio function


//========================================================================================
// Reset the fitsfile pointer


//========================================================================================
// Close the FITS file by calling the system dependent routine to physically
// close the FITS file and free the memory.


//==========================================================================================
// wrap the read() method with cfitsio of NASA. GYL


//================================================================================
// skip the next n logical record and then read the next one


//=====================================================================================================
// flush both io buffer of CFITSIO and m_buffer


//====================================================================================================
// attach a logical record to the fits file. addr must point to a logical record.


// Data conversion:  FitsBit


// Data conversion:  short


// Data conversion:  long


// Data conversion:  Int


// Data conversion:  float


// Data conversion:  double


// Data conversion:  Complex


// Data conversion:  IComplex


// Data conversion:  DComplex


// Data conversion:  FitsVADesc


// Swap routines for 2, 4 and 8 byte items


/******************************************************************************
	Fortran-77 Definition of integer, real, and double (no embedded blanks)
	--------------------------------------------------
		digit 		:= <0|1|2|3|4|5|6|7|8|9>
		digit_sequence 	:= digit [ digit ... ]
		sign 		:= <+|->
		point 		:= <.>
		integer 	:= [sign] digit_sequence
		efield 		:= E [integer]
		dfield 		:= D [integer]
		basic_real 	:= integer point [ digit_sequence ]
			           [sign] point digit_sequence
		real 		:= basic_real [ efield ]
				   integer efield
		double 		:= basic_real dfield
				   integer dfield

	FITS fixed formats on keyword cards (NOST 5.3.2)
	------------------------------------------------
	string		' in col 11, ' to close (in or before col 80),
			'' represents ' within the string,
			trailing blanks not significant
	logical		T or F in col 30
	integer		integer right justified in col 11-30
	complex integer	real part col 11-30, img part col 31-50, right just
	real float	real or double right justified in col 11-30, point req
	complex float	real part col 11-30, img part col 31-50, right just
******************************************************************************/


// Return the i-th keyword -- keyword numbering starts with 0


// Used for debug print statements
// #include <casacore/casa/Arrays/ArrayIO.h


// This is truely bizare.  For CFRONT based compiler the
// following is required in order for this all to compile.
// If this code is placed in place in filesInTimeRange where it
// is used, both Centerline and Sun's CFRONT compilers complain
// about not being able to find operator << (class ostream, unsigned int)
// It seems to be tied to Vector<Double> in some sense since
// commenting out all occurences of them makes the compiler
// happy (but the code unusable, obviously).  Moving the output
// cout outside of filesInTimeRange makes the problem go away.
// It is obviously a complicated interacting involving other
// elements of this class as I am unable to reproduce it except
// in this class.


// Do a reverse lookup since the FITS classes need it.


//============================================================================================
// special error handler function used by read_header_rec


//==========================================================================================
// Implement skip function with cfitsio of NASA. GYL


//===============================================================================================
// return the header of the chdu as a Vector of Strings.


//================================================================================================
// read a special record or an unrecognizable record


//========================================================================================================
// implement read_head_rec() with CFITSIO of NASA


//========================================================================================
// Implement the skip_hdu with cfitsio of NASA


//===============================================================================================
// Implement the read_all() method with the cfitsio of NASA.
// Read the whole data unit of current HDU from the beginning to end ( the
// condition m_curr_size = m_data_size guarantees this. The
// read data is stored into a char* buffer -- addr.
//
// If addr is too big, it cannot be fitted into memory. So if this function is
// called, m_data_size actually cannot be bigger than the machine's memory size.
// we still change the return type to OFF_T though.


//=========================================================================================
// Implement read() method with cfitsio of NASA throgh BlockInput::read().
// read next nb bytes into addr within the same hdu. If nb > m_curr_size,
// make nb = m_curr_size.


//==========================================================================================
// Implement the skip() method with cfitsio of NASA
// Skip the next nb bytes within the same HDU. If nb is greater than the data size left
// within the current HDU, skip to the end of the HDU. Return(with return statement) the
// number of bytes that is actually skipped.


//=====================================================================================
// Implement the skip_all() method with cfitsio of NASA
// Skip the remaining data within the current HDU, and then moving to the
// beginning of the data unit of the next hdu ( by calling read_header_rec());


//=========================================================================================
// Reset the fitsfile pointer


// FitsOutput::set_data_into() is used by PrimaryArray::write_priArr_hdr() etc.


// write all data from addr


// BlockOutput::write() is wraped to cfitsio already. So no need
// to directly wrap FitsOuput::write(). GYL


// Just returns the scalar type.


// takes a pointer to an array of chars and returns
// its length   A null character terminates the string
// and trailing spaces are not considered as part of the
// string


// Display basic info and the keyword list


// Read and display values from a FITS file


// This function determines the HDU type and the data type


// Compute the total size of the data associated with an HDU.  The number
// of dimensions is also determined.  This routine assumes that hdu type
// has been appropriately set, but it may be changed in the process.  Data
// type is also determined.


//=================================================================================================
// Use this constructor to construct objects that write only required keywords to fitsfile.
// the write method to call by these object should be those for the specific
// hdu, such as write_binTbl_hdr().


//================================================================================================
// Call this after write the specific header( and generate the FitsKeywordList
// the header info which has just been written.)


//=========================================================================================================
// Put required Header keywords into the ASCII Table:
/*Write the ASCII table header keywords into the CHU. The optional TUNITn and
  EXTNAME keywords are written only if the input pointers are not null. A null
  pointer may given for the *tbcol parameter in which case a single space will
  be inserted between each column of the table. Similarly, if rowlen is
  given = 0, then CFITSIO will calculate the default rowlength based on the
  tbcol and ttype values.
*/


//================================================================================
/*Put required Header keywords into the Binary Table:
  Write the binary table header keywords into the CHU. The optional
  TUNITn and EXTNAME keywords are written only if the input pointers
  are not null. The pcount parameter, which specifies the size of the
  variable length array heap, should initially = 0; CFITSIO will
  automatically update the PCOUNT keyword value if any variable length
  array data is written to the heap. The TFORM keyword value for variable
  length vector columns should have the form 'Pt(len)' or '1Pt(len)'
  where `t' is the data type code letter (A,I,J,E,D, etc.) and `len' is
  an integer specifying the maximum length of the vectors in that column
  (len must be greater than or equal to the longest vector in the column).
  If `len' is not specified when the table is created (e.g., the input
  TFORMn value is just '1Pt') then CFITSIO will scan the column when the
  table is first closed and will append the maximum length to the TFORM
  keyword value. Note that if the table is subsequently modified to
  increase the maximum length of the vectors then the modifying program
  is responsible for also updating the TFORM keyword value. GYL
*/


//===================================================================================
// We must specify FitsArray<Bit> as a specialized class.


// MJD seconds to day number and day fraction


// Extract the data from the PrimaryGroup object and stick it into
// the MeasurementSet
// keep the arrays of data in memory before dumping them in columns


// Extract the data from the PrimaryGroup object and stick it into
// the MeasurementSet
// Doing it row by row


// Returns the Direction Measure reference for UVW and other appropriate columns
// in _msc (which must exist but have empty columns before you can set it!).


// single source fits case


// Define a FITS random group parameter with default scaling and offset


/*
 allids: (input)  IDs to consider
 map:    (output) map from allids to 0,1,...,nr
 selids: (output) inverse of map

 returns: nr, number of selected IDs in allids
 */


//
// Convert part of the keywords in the FITS binary table extension
// header to a TableRecord (itsKwSet). MS-specific keywords, MSK...,
// are only scanned and buffered. They will be converted by
// convertMSKeywords().
//


//
// Convert FITS field descriptions to TableColumn descriptions. Also
// take into account the storage options specified in the MSK's.
//


//
// Convert the MS-specific keywords in the FITS binary table extension
// header to a TableRecord (itsKwSet).
//


// Fred Schwab's rational approximation for 2-bit sampling with n =
// 3.336 and optimally chosen v_0.  See VLBA Correlator Memo 75.


// fill Observation table


// method for filling Spectral window table.


// method to fill Field Table


//
// Null constructor merely sets private formatting string
//


//
// Constructor assigns pointer (if MS goes out of scope you will get rubbish),
// initialises the output, sets string to format output, and initialises the
// listing.
//


//
// Reinitialise output stream.  Do this before setMS() if doing both.
//


//
// Reassign MS pointer and reinitialise MSLister object.  Do this after
// setNewOS() if doing both.
//


//
// initList() does things that need to be done once per MS: initialises
// the pagination/formatting, lists some header information, initialises
// the MSSelector object, and gets all the attribute ranges up front.
//


// This function is not currently used.  However, if an output precision
// option is added to this class, this will be useful.


// CLEANUP: This function is currently not used.  Remove it?


// Get the ranges of a fixed set of MS key attributes


// CLEANUP: Remove parameters that are not inputs to mssSetData; they are no
//   longer used anywhere.


// Parse the correlation (polarization) selection string.
// Vector<Int> indexPols_p holds the indices of pols_p that
// match the correlation selection. nIndexPols_p holds the
// number of elements in indexPols_p.


//
// Clear all the formatting flags
//


//
// Constructor assigns pointer.  If MS goes out of scope you
// will get rubbish.  Also sets string to separate subtable output.
//


//
// Get ms name
//


//
// List information about an ms to the logger
//


//
// List a title for the Summary
//


// Add new hypercubes as the shape changes


//getAnt(telescope_p, nAnt, xyz_p, diam_p, offset_p, mount_p, antName_p,
//		    coordsystem_p, mRefLocation_p)) {


// if known already e.g. from openfromms()


// NOTE:  initAnt and initSpWindows must be called before this one!


// Calculates the fractional blockage of one antenna by another
// We will want to put this somewhere else eventually, but I don't yet know where!
// Till then.
// Stolen from Fred Schwab


// compute parallactic angle.


/*
 * This function will be called by nftw() with a path arguments and will remove the file in the path
 */


//# Constructor with given ms name.


//# Parse the command.
//# Do a yyrestart(yyin) first to make the flex scanner reentrant.
//----------------------------------------------------------------------------


//# Get the next input characters for flex.
//----------------------------------------------------------------------------


//# Give the table expression node
// const TableExprNode* msObservationGramParseNode()
// {
//   //    return MSObservationParse::node();
//     return &MSObservationParse::thisMSObsParser->node();
// }


//-------------------------------------------------------------------
// Constructor with given ms name.
//


//
// MSMainColInterface objects is a generalization of
// MSMainColumns.  This is constructed with a Table, which can be
// MS or CalTable (or any other table with interface methods like
// those in MSMainColumns.  The access methods of MSMainColumns
// allowed via MSMacinColInterface are flag(), flagRow(),
// exposureQuant() and timeQuant().
//
// The MSMainColInterface::flagRow(int &) is slightly slower than
// MSMainColumns::flagRow()(int &) interface.  However since this
// is used only to determine the first unflagged row, the loss in
// effciency should not be an issue.
//


//# Constructor with given ms and main-column of interest supplied
//# as a TEN.  This allows making the parser generic to work for
//# both MS and CalTables.


// TableExprNode msFieldGramParseCommand (const MeasurementSet* ms, const String& command, Vector<Int>& selectedIDs)
// {
//   //    MSFieldParse *thisParser = new MSFieldParse(ms);
//   TableExprNode dummy,ten;
//   MSFieldParse *thisParser = new MSFieldParse(ms->field(),dummy);
//   ten=baseMSFieldGramParseCommand(thisParser, command, selectedIDs);
//   delete thisParser;
//   return ten;
// }


//# Constructor with given ms name.
//------------------------------------------------------------------------------
//


//
//------------------------------------------------------------------------------
//  Give a list of pol IDs, return the list of row numbers in the
//  POLARIZATION sub-table which contains the listed Pol IDs.  Pol
//  IDs are defined as the enumrations Stokes::StokesTypes -
//  i.e. "RR", "LL" etc.
//


//
//------------------------------------------------------------------------------
//
// The actual parser.  Does three things:
//   1. Tokenize the [SPW:]POLN string into SPW and POLN tokens.
//   2. Generate list of indices using SPW and POLN tokens.
//   3. Generate the {SPW, POLN} --> DDID map
//


//
//------------------------------------------------------------------------------
//  A convenience method to set the vectors of Poln or DD IDs in the setupMap.
//


//
//------------------------------------------------------------------------------
//
//# Give the table expression node


// Add the current condition to the TableExprNode tree.  Mask auto
// correlations if baselineType==CrossOnly
//


//
// Method to make a list of unique baselines, given a list of
// antenna1 and antenna2.  The baselines list is appended to the
// existing list.  The required sizing could be done better.
//


// Add for MS selection


//
// Method to make a list of unique feed pairs, given a list of
// feed1 and feed2.  The feed pairs list is appended to the
// existing list.  The required sizing could be done better.
//


//
//------------------------------------------------------------------
// Input list modifier.  Examine the input list and treat elements
// greater than the number of SPWs by matching them as name
// strings. Elements for which this match fails or which are less
// than the number of SPWs remain unmodified.


//
//------------------------------------------------------------------
//
//# Constructor with given ms name.


//
//----------------------------------------------------------------------------
// Method to install the defaul error handler or reset existing
// error handlers. If the pointer to error handler is NULL, this
// method will install the default error handler.  If the pointer is
// != NULL, this method will reset the existing error handler.
//
// The operations in this method requires modifying the error
// handler pointer in various parsers (which are in C, not C++).
// This dual-purpose design of this method (reset or install error
// handlers) is to keep the handling of error-handler pointers
// localized to this method only.
//


//----------------------------------------------------------------------------
//
// Forst the setting of the static error handlers to a known state
// (NULL)
//


//----------------------------------------------------------------------------
// This function also optionally sorts the matrix of SPWIDs and
// associated channel selection indices in ascending order of
// SPWIDs.
//


// reorder from 2d to 1d (removing ifr axis)


// reorder from 3d to 2d (removing ifr axis)


//-------------------------------------------------------------------------
// Input list modifier. Elements in the list greater than the number
// of fields are converted to string and matched against field
// names.  If a match is found, the element is replaced with the
// matched name ID (sub-table row number).  Elements less than the
// number of fields are left unmodified.


//# Give the table expression node
// const TableExprNode* msScanGramParseNode()
// {
//   //    return MSScanParse::node();
//     return &MSScanParse::thisMSSParser->node();
// }


// this version has info of MeasFrame.


// test functions, all return the number of errors unless otherwise stated
// test PredefinedColumns static functions in MeasurementSet


// test PredefinedKeywords static functions in MeasurementSet


// test addColumnToDesc static for all possible columns


// Test most of the non-static functions


// test null MS


// test exceptions in constructions


// This test exercises the generic sorting function constructor
// with a trivial comparison which always compares two values equal.
// The result is that all the rows are grouped together.


// Comparison function that groups together antenna 0 and 1
// and antenna 2 on a different group


// This test exercises the generic sorting function constructor
// with a comparison function that groups together antennas 0 and 1
// and leaves antenna 2 in a different group


// This test exercises the lazy caching mechanism for retrieving
// metadata related to DD and FEED.


// This test exercises the lazy caching mechanism for retrieving
// metadata related to FIELD


// Copy (or symlink) directories that are not a subtable.
// In that way possible instrument and sky model tables can be copied.


// print DocBook File


/**
   * escape certain characters for DocBook
   */


// copy a string array


// finish the clone of an attribute


// write the label for the XML schema and schematron file.


// write the schematron rules


// write the XML Label


// write the XML Schema File Header


// represents the class


// write the associations in the class


// write the assertions - simple attribute enumerations


// write the class XSAny statements


// write the Type List XSAny statements


// write the mission and node areas


// write the attribute definitions for all attributes used by classes that were written


// write the attribute types


// write the attribute


// write the XML Schema data types


// write the XML Schema Units Of Measure


// write the XML Schema Nill Values


// return the input string with an optional append blank if it does not have a whitespace in its last 72 chars


// write all Schematron files


// check if assert statement already exists


// 555 TBD clean up assertMsg


// write the schematron file header


// write the SKOS file


// Print the JSON Header


// Format the String for JSON


// print the JSON body


// Print the classes


// Print the Attributes


// Print the Associations


// Print the Data Types


// Print the data type Pattern


// Print the Units


// Print the Unit Identifier


// Print the the Protege Pins Properties


// Print the the Protege Pins CD


// Print the the Protege Pins DEC


// Print the the Protege Pins TE


// Print the the Protege Pins Misc


/**********************************************************************************************************
   * print the various artifacts
   ***********************************************************************************************************/


/**
   * Print standard section
   */


/**
   * Print Class Hierarchy
   */


/**
   * Print a section of the table of contents
   */


/**
   * Print a model in table format as a subsection (added values and fixed card)
   */


/**
   * Print out a class
   */


/**
   * Print a table row
   *
   */


/**
   * Print HTML table Header
   */


/**
   * Print a HTML table row
   */


/**
   * Print a simple table row
   */


/**********************************************************************************************************
   * routines for printing the data dictionary
   ***********************************************************************************************************/


/**
   * Print a data element
   */


/**
   * Print an attributes unit
   */


/**
   * Print an attributes type
   */


/**
   * Print an attributes values
   */


/**
   * Print an attributes Extended values
   */


/**
   * Print schematron rule for the attribute
   */


/**********************************************************************************************************
   * routines for printing the glossary
   ***********************************************************************************************************/


/**
   * bump current level by one
   */


/**
   * decrement current level by one
   */


/**
   * decrease number of levels by one
   */


/**
   * print item number
   */


/**
   * Replace string with string (gleaned from internet)
   */


// write the JSON file


// write the JSON string to a file


// Print the Query Model Terminological Entries


// Print the Query Model Term Entry List


// write the RDF/OWL file


// Print the RDF/OWL Header


// print the RDF/OWL body


// write the PDS4 classes as OWL classes


// write a single PDS4 classes as an OWL class


// write the PDS4 attributes as OWL classes


// write a single PDS4 attribute as an OWL class


// write a single permissible value as a OWL class


// write the Data Types as OWL classes


// write the Units as OWL classes


// write a set of disjoints


// Print the Permissible Values and Value Meanings


// Format the String for RDF/OWL


// write the Data Element Product files


// Print the Element Definition Header


// write the Product Class Definition files


// Print the class Definition Header


/**
   * Opens a FileReader and parses a Protege Frames file (.pont or .pins) and creates an array of
   * tokens.
   */


// get an ODL statement from the parsed tokens.


// Print the JSON Footer


// Print the the Protege Pins DE


// Print the Property Maps


// Print the Property Map


// Print the Property Map Entrys


// Print the Terminological Entries


// write the property maps


// Print the Footer


// print the body


// write the CSV File


//	write terminological entries


/**
   * Execute this plugin. The exeuction of this plugin uses the Template Method design pattern.
   *
   * @throws MojoExecutionException If the center does not hold.
   */


/**
   * main method
   *
   * @param args
   * @throws Throwable
   */


/**
   * DMDocument Plugin Runner
 * @throws Throwable
 * @throws IOException
   */


/**
   * convert from string to hex
   */


// process -p, -l, and -V to determine IM Version to use


// process remaining arguments, for -v (version) return false to exit application


// 012 - remove URI Attribute


/**
   * Check whether attribute is restricted
   */


// 025 - Set the DEC and CD for each attribute.


// 026 - set up master conceptual domain array


// 027 - Set Master Attribute XML Base Data Type From the Data Type


/**
   * Fixup name spaces and base class name - final cleanup
   */


/**
   * Check for attributes with the same ns:title but different constraints. (attributes with the
   * same ns:title can be used in two or more classes this check ensures that they all have the same
   * values for the meta-attributes Description alone is allowed to be different *** Different
   * constraints would cause multiple simpleType definitions ***
   */


// set up the 11179 elements


// scan through the master class list and overwrite with the latest from the 11179 DD database.


// generate schematron rules


// add the enumerated value schematron rules


// add rules for child classes of a parent Associated External Class


// add the boolean schematron rules


// add the schematron rules for deprecation


// add the schematron rules for UnitId deprecation


// add the Discipline schematron rules


// add the enumerated unit schematron rules


// find offending rule


// Format the iri


// Format the LID and LIDVID


// Format the string


// print the ISO 11179 DD in RDF


/**
   * Print the ISO Data Element
   */


/**
   * Print the ISO Value Domain
   */


/**
   * Print the ISO Permissible Value and Value Meaning
   */


/**
   * Print the ISO Terminological Entry
   */


/**
   * Print the ISO Conceptual Domains
   */


/**
   * Print the ISO Data Element Concepts
   */


// write the ISO/IEC 11179 Header


// write the PINS file


// Print the Protege Pins Header


// Print the the Protege Pins Object Class (OC)


// Print the the Protege Pins VD


// Print the the Protege Pins TE for Data Elements


// Print the the Protege Pins TE for Object Classes


/**********************************************************************************************************
		write custom documents and files
***********************************************************************************************************/


// PDS Common Dictionary --- set namespace below ---


// PDS Common Context --- set namespace below ---


// PDS LDD -- DISP - set namespace below - replace method name above ---


// PDS LDD -- PROC - set namespace below - replace method name above ---


// PDS LDD -- Geom --- set namespace below ---


// EIM Classes --- set namespace below ---


// Selecte EIM Classes --- set namespace below ---


// OAISIF selected classes --- set namespace below ---


// write the XML File


// write the XMI Header


// write the XMI Footer


// write the XMI Class


// dump master 11179 Data Dictionary


/**********************************************************************************************************
   * write the various documents and files
   ***********************************************************************************************************/


// convert a Protege Attribute to a DOM Property


// convert a Protege Value Array (valArr) to a DOMPermValDefn


// create a DOM Property


/**
   * return a fundamental structure
   */


// reset class order


/**
   * wrap a text string
   */


/**
   * escape certain characters - LaTEX
   */


/**
   * escape certain characters for protege files
   */


/**
   * unescape pattern characters from protege files
   */


/**
   * escape *** PATTERN only *** characters for protege files
   */


/**
   * unescape *** PATTERN ONLY *** characters from protege files
   */


/**
   * escape pattern in local DDs for protege files
   */


/**
   * escape certain characters - XML
   */


/**
   * escape certain characters - JSON
   */


/**
   * escape certain characters for the WIKI
   */


/**
   * remove certain characters from input strings (model - e.g. value meanings should not have
   * <cr><lf>
   */


/**
   * Convert String to int
   */


/**
   * print all classes
   */


/**
   * print one attribute
   */


/**
   * print one rule
   */


// write the mapping file


// write Property maps


// process termMap one line at a time


// Print the SKOS Header


// write the TTL file


//	print the body


//	public  void writeClassDefn (ClassPropertiesOWL lClassPropertiesOWL, ClassAttrPropClassification lClassAttrPropClassification, boolean useISA) {


// write the RDF for classes associated with the class.


// write the values of *_type as subclasses (e.g., Instrument.type = Accelerometer)


// write the RDF for attributes associated with the class.


// write RDF for the rdfs:subClassOf property; label as ISA


// write the one definition for attributeOf


// write the one definition for componentOf


// resolve all class associations


// add the LDD artifacts to the Master


// print document header


// print one attribute


// print one class


// finish copying in the values of the USER attribute


// print one line


// print protege pont file


// print one protege attribute


// print attribute values


// print print protege class - begin


// print a class


// print an property


// print an attribute


// write an attribute, one line


// write the Registry Information Model Configuration file - JSON


// write the Registry Information Model Configuration file - JSON and XML


// write the Registry Information Model Configuration file - XML


/**
     *  This method runs the Lddtool and captures its output
     * @param args the command line arguments to pass to lddtool
     * @return the output of lddtool
     * @throws Throwable if an error occurs while running lddtool
     */


/**
     * This method resolves the command arguments by replacing placeholders with actual values
     * @param args the command arguments
     * @return a String array containing the resolved command arguments
     */


/**
     * This method moves generated files from the source directory to the target directory
     * @param sourceDir the source directory
     * @param targetDir the target directory
     * @param pattern the pattern to match the files to move
     * @throws IOException if an I/O error occurs
     */


/**
     * This method creates an output file with the specified content
     * @param output the content of the output file
     * @param fileName the name of the output file
     * @throws IOException if an I/O error occurs
     */


/**
     * This method reads the content of a file
     * @param fileName the name of the file to read
     * @return the content of the file
     * @throws IOException if an I/O error occurs
     */


/**
     * This method finds a file with the specified extension in the specified directory
     * @param directoryPath the path of the directory to search
     * @param fileExtension the extension of the file to find
     * @return the file as a string
     * @throws Exception if the file is not found, multiple files are found, or the directory is invalid
     */


/**
     * This method filters the lines of a file based on the specified strings
     * @param lines the lines to filter
     * @param excludeStrings the strings to exclude
     * @return the filtered lines
     */


/**
     * This method is called after each test case to compare the actual output with the expected
     * output
     *
     * @param assertType the type of assertion to perform
     * @param output the expected output
     * @param actualOutputFile the source of the actual output
     */


/**
     * This method is called after each test case to compare the actual-generated file with the
     * expected file
     *
     * @param actualOutputFile the source of the actual output
     * @param expectedOutputFile the source of the expected output
     * @param excludeStrings the lines to exclude from the comparison
     */


/*
     * This method is called after each test case to clean up the test environment
     */


/**
     * Run the server
     * @return 0 - server started without errors; 1 or greater - there was an error
     */


/**
     * Start embedded web server
     * @param port a port to listen for incoming connections
     */


/**
     * Print help screen.
     */


/**
     * Print Harvest version
     */


/**
     * Process Directory Message
     * @param dirMsg directory message
     * @throws IOException an exception
     */


/**
     * Process a file
     * @param path file path
     * @param dirMsg Directory message being processed
     * @param fileBatch file batch info
     * @throws IOException an exception
     */


/**
     * Apply product class filters declared in a directory message to
     * a product class of a PDS label file to find out if this file
     * should be skipped / ignored.
     * @param dirMsg directory message with product class filters
     * @param prodClass product class of a PDS label file
     * @return true if the PDS label file with a given product class should be skipped
     */


/**
     * Publish File Message to a RabbitMQ queue
     * @param dirMsg Directory message being processed
     * @param batch file batch info
     * @throws IOException an exception
     */


/**
     * Publish Directory Message to a RabbitMQ queue
     * @param dirMsg Directory message being processed
     * @param path directory path
     * @throws IOException an exception
     */


/**
     * Start consumer thread
     */


/**
     * Handle delivery of a new message from the directory queue
     */


/**
     * Non-transport exception (ExceptionListener)
     */


/**
     * Transport exception (TransportListener)
     */


/**
     * Create new Directory Message from a Job Message and a directory
     * @param jobMsg job message
     * @param dir directory
     * @return new DirectoryMessage
     */


/**
     * Create new Directory Message from a Job Message and a manifest file
     * @param jobMsg job message
     * @param manifest manifest
     * @return new DirectoryMessage
     */


/**
     * Create new Directory Message from a Directory Message and a directory
     * @param dirMsg job message
     * @param dir directory
     * @return new DirectoryMessage
     */


/**
     * Adds a file path and corresponding LIDVID
     * @param path file path
     * @param info PDS label info, including LIDVID
     */


/**
     * Build collection inventory message
     * @param dirMsg directory message being processed
     * @param collectionFile collection file
     * @param info basic PDS label info
     * @return new collection inventory message
     */


/**
     * Create new Product Message from a Directory Message and a File Batch
     * @param dirMsg directory message
     * @param batch file batch
     * @return new file message
     */


/**
     * Connect to RabbitMQ server. Wait until RabbitMQ is up.
     */


/**
     * Read configuration file (Java properties / key-value file)
     * @param file a configuration file
     * @return parsed configuration
     * @throws Exception an exception
     */


/**
     * Configure Log4j v2 logging library.
     * @param verbosity Log verbosity value: { ALL, INFO, WARN, ERROR }
     * @param filePath Log file path
     */


/**
	 * Returns whether the specified LidarFileSpec has been loaded.
	 */


/**
	 * Notification method that the lidar data associated with the FileSpec has
	 * been loaded. The provided VtkLidarDataPainter will contain the loaded
	 * state.
	 */


/**
	 * Helper method to load the lidar data into a VtkLidarDataPainter.
	 * <P>
	 * The actual loading of the lidar data may happen asynchronously.
	 */


/**
	 * Helper method that updates the {@link StatusNotifier} with the selected
	 * items.
	 */


/**
	 * Helper method that will update all relevant VTK vars.
	 */


/**
	 * Helper method that will update all relevant VTK vars.
	 * <P>
	 * A notification will be sent out to PropertyChange listeners of the
	 * {@link Properties#MODEL_CHANGED} event.
	 */


/**
	 * Returns the LidarPoint that was read from the stream.
	 * <P>
	 * Returns null if any {@link EOFException} is thrown
	 */


/**
	 * Writes a LidarPoint to the specified stream.
	 *
	 * @param aStream
	 * @param aLP
	 * @throws IOException
	 */


/**
	 * Helper method that handles the apply action.
	 */


/**
	 * Helper method that handles the pick folder action.
	 */


/**
	 * Helper method that forms the GUI.
	 */


/**
	 * Helper method to keep the GUI synchronized
	 */


/**
	 * Helper method to configure the column widths on the track table
	 */


/**
	 * Helper method that handles the color config action
	 */


/**
	 * Helper method that handles the drag action
	 */


/**
	 * Helper method that handles the pointSize action
	 */


/**
	 * Helper method that handles the radialOffset action
	 */


/**
	 * Helper method that handles the radial reset action
	 */


/**
	 * Helper method that handles the save action
	 */


/**
	 * Helper method that handles the drag action.
	 */


/**
	 * Helper method that forms the configuration options that are placed on the
	 * left side.
	 */


/**
	 * Helper method to update the error UI
	 */


/**
	 * Updates the various UI elements to keep them synchronized
	 */


/**
	 * Helper method that handles the load action.
	 */


/**
	 * Helper method that handles the reset action.
	 */


/**
	 * Helper method that handles the track mutation event.
	 */


/**
	 * Helper method that handles the track selection change event.
	 */


/**
	 * Helper method to keep the GUI synchornized
	 */


/**
	 * Creates a skeleton for the specified DataSource.
	 */


/** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */


/**
	 * Helper utility method that forms the 'browse' tabbed panel.
	 */


/**
	 * Helper utility method that forms the 'custom' tabbed panel.
	 */


/**
	 * Helper utility method that forms the 'search' tabbed panel.
	 */


/**
	 * Utility helper method that notifies the {@link PickManager}'s default
	 * picker that a {@link VtkPropProvider}'s state has changed.
	 * <p>
	 * This notification will be sent only if @link VtkDemPainter corresponding
	 * to the specified @link Dem has reached a "ready" state.
	 */


/**
	 * Method that will populate the table with LidarFileSpecs relative to the
	 * specified data source.
	 */


/**
	 * Helper method that handles the save action.
	 */


/**
	 * Method that performs the actual query for lidar tracks when the submit
	 * action is triggered.
	 */


/**
	 * Helper method that will populate the sourceBox with the available data
	 * sources.
	 */


/**
	 * Helper method that handles the manage sources action.
	 */


/**
	 * Helper method that handles the select region action.
	 */


/**
	 * Helper method that handles the submit action.
	 */


/**
	 * Helper method that forms the "Search" panel.
	 */


/**
	 * Helper method that adds the 'Spacecraft Range' UI section
	 */


/**
	 * Helper method that performs the actual search query and installs the
	 * resulting Tracks into aTrackManager.
	 */


/**
	 * Helper method to update the time range for the specified JSpinner.
	 *
	 * @param aSpinner
	 * @param aBegTime
	 * @param aEndTime
	 */


/**
	 * Forms the popup menu associated with lidar files.
	 */


/**
	 * Forms the popup menu associated with lidar tracks.
	 */


/**
	 * Utility method that returns true if the specified {@link PickTarget} is
	 * associated with the provided {@link StructureManager}.
	 */


/**
	 * Utility method that sends out a status update of the specified items.
	 */


/**
	 * Helper method that handles the action for srcColorB
	 */


/**
	 * Helper method that handles the action for tgtColorB
	 */


/**
	 * Helper method that will update the UI to reflect the user selected colors.
	 */


/**
	 * Helper method to calculate the range of values for the specified
	 * {@link FeatureType}.
	 */


/**
	 * Helper method that updates the default range for all of the lidar
	 * {@link FeatureType}s.
	 */


/**
	 * Helper method that keeps the {@link ColorBarPainter} synchronized with the
	 * gui.
	 */


/**
	 * Helper method that will update the fullRangeZ state var to include the
	 * specified lidar data.
	 */


/**
	 * Utility method to synthesize a Track.
	 *

	 * Null will be returned if any of the following is true:
	 *

	 *
Insufficient number of points.
	 *
Time associated with the first or last lidar point is not valid.
	 *

	 *
	 * @param aIdGenerator
	 * @param aPointL
	 * @param aSourceS
	 * @return
	 */


/**
	 * Runs the specified (classic) query and installs formed Tracks into the
	 * specified LidarTrackManager.
	 */


/**
	 * Runs the specified (hyper tree) query and installs formed Tracks into the
	 * specified LidarTrackManager.
	 * <P>
	 * TODO: Add more details to the comments.
	 */


/**
	 * Runs a query and returns the appropriate Tracks.
	 * <P>
	 * TODO: Add more details to the comments.
	 */


/**
	 * Runs a query and returns the appropriate Tracks.
	 *

	 * TODO: Add more details to the comments.
	 *

	 * The field aCubeList corresponds to the list of leaves of an hypertree /
	 * octree that intersect the bounding box of the user selection area.
	 */


/**
	 * Loads a list of LidarPoints from the specified text file.
	 *
	 * @See {@link LIDARTextInputType}
	 *
	 * @param aFile The file of interest.
	 * @return The list of the loaded LidarPoints.
	 * @throws IOException
	 */


/**
	 * Loads a list of LidarPoints from the specified (raw binary) file.
	 *
	 * @param aFile The file of interest.
	 * @return The list of the loaded LidarPoints.
	 * @throws IOException
	 */


/**
	 * Loads a list of LidarPoints from the specified PLY file.
	 *
	 * @param aFile The file of interest.
	 * @return The list of the loaded LidarPoints.
	 * @throws IOException
	 */


/**
	 * Utility method that returns the Tracks loaded from the specified files.
	 *
	 * @throws IOException
	 */


/**
	 * Loads a list of LidarPoints from the specified Ola2 file.
	 *
	 * @param aFile The file of interest.
	 * @return The list of the loaded LidarPoints.
	 * @throws IOException
	 */


/**
	 * Save track as binary file. Each record consists of 7 double precision
	 * values as follows:
	 *

	 *
1. ET
	 *
2. X target
	 *
3. Y target
	 *
4. Z target
	 *
5. X sc pos
	 *
6. Y sc pos
	 *
7. Z sc pos
	 *

	 * If transformPoint is true, then the lidar points (not scpos) are
	 * translated using the current radial offset and translation before being
	 * saved out. If false, the original points are saved out unmodified.
	 *
	 * @param aManager
	 * @param aFile
	 * @param aTrack
	 * @param transformPoint
	 * @throws IOException
	 */


/**
	 * Saves the list of Tracks to the specified folder. Each file will be saved
	 * to a separate file.
	 */


/**
	 * Saves the list of Tracks to the specified file.
	 * <P>
	 * If transformPoint is true, then the lidar points (not scpos) are
	 * translated using the current radial offset and translation before being
	 * saved out. If false, the original points are saved out unmodified.
	 *
	 * @param aManager
	 * @param aFile
	 * @param aTrackC
	 * @param transformPoint
	 *
	 * @throws IOException
	 */


/**
	 * Utility method that returns true if this is hayabusa specific data.
	 * <P>
	 * TODO: Due to the deficient design several aspects of this code is specific
	 * to an instrument. This should be rectified.
	 */


/**
	 * Utility method to load the lidar data associated with the specified
	 * LidarFileSpec into a {@link VtkLidarUniPainter}.
	 * <P>
	 * On success the loaded {@link VtkLidarUniPainter} will be installed into
	 * the provided LidarFileSpecManager.
	 *
	 * @param aManager
	 * @param aFileSpec
	 * @param aBodyViewConfig
	 * @throws IOException
	 */


/**
	 * Utility helper method that will load a Hayabusa lidar data file into a
	 * {@link VtkLidarStruct}.
	 * <P>
	 * Returns the loaded {@link VtkLidarStruct}.
	 *
	 * @param aManager
	 * @param aFileSpec
	 * @param aFile
	 */


/**
	 * Utility helper method that will load ASCII lidar data file into a
	 * {@link VtkLidarStruct}.
	 * <P>
	 * Returns the loaded {@link VtkLidarStruct}.
	 *
	 * @param aManager
	 * @param aFileSpec
	 * @param aFile
	 */


/**
	 * Utility helper method that will load binary lidar data file into a
	 * {@link VtkLidarStruct}.
	 * <P>
	 * Returns the loaded {@link VtkLidarStruct}.
	 */


/**
	 * This function takes a lidar track, fits a plane through it and reorients
	 * the track into a new coordinate system such that the fitted plane is the
	 * XY plane in the new coordinate system, and saves the reoriented track and
	 * the transformation to a file.
	 *
	 * @param aTrack The Track of interest.
	 * @param aFile - save reoriented track to this file
	 * @param rotationMatrixFile - save transformation matrix to this file
	 * @throws IOException
	 */


/**
	 * Helper method that takes the given point and returns a corresponding point
	 * that takes into account the specified translation and the radial offset.
	 *
	 * @param aTranslationV The translation vector of interest.
	 * @param aRadialOffset An offset in the radial direction.
	 * @param aTargetV The point of interest.
	 * @return
	 */


/**
	 * Similar to previous function but specific to spacecraft position. The
	 * difference is that we calculate the radial offset we applied to the lidar
	 * and apply that offset to the spacecraft (rather than computing the radial
	 * offset directly for the spacecraft).
	 *
	 * @param aTranslationV The translation vector of interest.
	 * @param aRadialOffset An offset out in radial direction.
	 * @param aTargetV
	 * @param aSourceV
	 * @return
	 */


/**
	 * It is useful to fit a line to the track. The following function computes
	 * the parameters of such a line, namely, a point on the line and a vector
	 * pointing in the direction of the line. Note that the returned
	 * fittedLinePoint is the point on the line closest to the first point of the
	 * track.
	 */


/**
	 * It is useful to fit a plane to the track. The following function computes
	 * the parameters of such a plane, namely, a point on the plane and a vector
	 * pointing in the normal direction of the plane. Note that the returned
	 * pointOnPlane is the point on the plane closest to the centroid of the
	 * track.
	 */


/**
	 * Loads the list of LidarFileSpecs from the specified BodyViewConfig.
	 */


/**
	 * Loads the list of LidarFileSpecs from the specified catalog file.
	 *
	 * @param aRemotePathStr File path relative to the SBMT server
	 */


/**
	 * Utility method that will create a vtkGeometryFilter for the specified
	 * vtkDataObject.
	 */


/**
	 * Utility method that will create a {@link VtkLidarStruct} for the specified
	 * parameters.
	 * <P>
	 * The returned {@link VtkLidarStruct} life cycle must be managed by the
	 * caller of this method.
	 *
	 * @param aPointIter The LidarPoints associated with the lidar data object.
	 */


/**
	 * Utility helper method that forms a vtkPolyData that is useful for
	 * resetting other vtkPolyData.
	 */


/**
	 * Helper method that performs the initial VTK setup of source/target points
	 * and colors.
	 */


/**
	 * Helper method to update the VTK state associated with the colors of the
	 * lidar data.
	 */


/**
	 * Helper method to update the VTK state associated with the translation of
	 * the lidar data.
	 *
	 * @param aTranslationV
	 */


/**
   * A method to parse the command-line arguments.
   *
   * @param args The command-line arguments
   * @return A class representation of the command-line arguments
   *
   * @throws ParseException If there was an error during parsing.
   */


/**
   * Examines the command-line arguments passed into the Harvest Tool
   * and takes the appropriate action based on what flags were set.
   *
   * @param line A class representation of the command-line arguments.
   *
   * @throws Exception If there was an error while querying the options
   * that were set on the command-line.
   */


/**
   * Displays tool usage.
   *
   */


/**
   * Displays the current version and disclaimer notice.
   *
   */


/**
   * Log the report header.
   *
   */


/**
   *
   * Do the transformation.
   */


/**
   * Extracts a table to the output file.
   *
   * @param reader the table reader to use for reading data
   * @throws TransformException
 * @throws CsvValidationException
   */


/**
   * Displays the headers of the table.
   *
   * @param fields an array of field descriptions
   * @param displayFields an array of field indices to display
   * @param fieldLengths an array of field lengths to use for output
   */


/**
   * Displays the rows from the table.
   *
   * @param reader the table reader for reading rows
   * @param fields an array of field descriptions
   * @param displayFields an array of field indices to display
   * @param fieldLengths an array of field lengths to use for output
   * @throws TransformException
 * @throws CsvValidationException
   * @throws IOException
   */


/**
   * Try to convert a field name or index into a field index.
   * Prints an error message and exits if the field is not
   * present in the table.
   *
   * @param nameOrIndex the string form of the name or index requested
   * @param fields the field descriptions for the table fields
   * @return the index of the requested field
   * @throws TransformException
   */


/**
   * Displays a string, justified in a field.
   *
   * @param s the string to display
   * @param length the field length
   * @param isRightJustified true, if the value should be right-justified, else left-justified
   */


/**
   * Displays a number of padding spaces.
   *
   * @param n the number of spaces
   */


/**
   * Method that checks if a log record is loggable.
   *
   * @param record The LogRecord.
   *
   * @return true if the record can be logged by the handler.
   *
   */


/**
   * Gets an instance of a Transformer. If the given label ends in ".xml",
   * then this will return a PDS4 Transformer object. Otherwise, a PDS3
   * Transformer object will be returned.
   *
   * @param target A PDS3 or PDS4 label file.
   * @param format The transformation format.
   *
   * @return The appropriate Transformer object.
   *
   * @throws TransformException If the input label could not be opened or
   * the format type is not one of the valid formats.
   */


/**
   * Transform the given PDS4 label into a PDS3 label.
   *
   * @param pds4Label The PDS4 label to transform.
   *
   * @return a Label object representation of the PDS3 label.
   *
   * @throws TransformException If an error occurred during transformation.
   */


/**
   * Maps the data object to a PDS3 Statement.
   *
   * @param dataObject The data object to map.
   * @param counter Used to uniquely name the PDS3 object
   *   (i.e. TRANSFORM1_IMAGE, TRANSFORM2_TABLE)
   *
   * @return A PDS3 Object Statement.
   *
   * @throws TransformException If an error occurred during transformation.
   */


/**
   * Maps the PDS4 table object to a PDS3 table object.
   *
   * @param tableBase The table to map.
   * @param objectName The name to give the PDS3 table object.
   *
   * @return A PDS3 Object Statement of the table.
   *
   * @throws TransformException If an error occurred during transformation.
   */


/**
   * Maps the PDS4 delimited table object to a PDS3 Spreadsheet object.
   *
   * @param tableBase The PDS4 Delimited Table object.
   * @param objectName The name to give the PDS3 spreadsheet object.
   *
   * @return A PDS3 Object Statement of the spreadsheet.
   *
   * @throws TransformException If an error occurred during transformation.
   */


/**
   * Maps the given fields to its equivalent PDS3 column or container object.
   *
   * @param fields A list of field objects to map.
   *
   * @return A list of the transformed column and/or container objects.
   *
   * @throws TransformException If an error occurred during transformation.
   */


/**
   * Map the given field to its equivalent PDS3 column object.
   *
   * @param field The PDS4 field object.
   * @return An object statement of the PDS3 column or field.
   */


/**
   * Maps the given Packed Data Field object to its equivalent PDS3 bit columns.
   *
   * @param packedDataFields The Packed Data Field object to map.
   *
   * @return A list of PDS3 bit column objects.
   */


/**
   * Maps the given group field objects to a PDS3 container object.
   *
   * @param group The group field object to map.
   *
   * @return An object statement of the PDS3 container object.
   *
   * @throws TransformException If an error occurred during transformation.
   */


/**
   * Maps the array to its equivalent PDS3 image object.
   *
   * @param array The Array object to map.
   *
   * @param objectName The name to give the PDS3 image object.
   *
   * @return An object statement of the PDS3 image.
   * @throws TransformException
   */


/**
   * Maps the PDS4 data type to its equivalent PDS3 data type.
   *
   * @param dataType The PDS4 data type to map.
   * @param dataObject The data object associated with the given data type.
   *
   * @return A list of statements that represents the equivalent PDS3 data type.
   */


/**
   * Creates a pointer statement.
   *
   * @param dataObject The data object.
   * @param counter A counter to uniquely name the pointer.
   * @param dataFile The data file to put into the pointer.
   *
   * @return A pointer statement.
   */


/*
  @Override
  public List<File> transform(File target, File outputDir, String format,
      String dataFile, int index) throws TransformException {
    return transform(target, outputDir, format);
  }
  */


/*
  @Override
  public List<File> transformAll(File target, File outputDir, String format)
      throws TransformException {
    List<File> outputs = new ArrayList<File>();
    outputs.addAll(transform(target, outputDir, format));
    return outputs;
  }
*/


/**
	 * Creates the Table_Delimited label.
	 *
	 * @param objectAccess The ObjectAccess object.
	 * @param target The target label.
	 * @param outputsToTables A mapping of the outputs to table objects.
	 * @param outputDir The directory where to write the label.
	 *
	 * @return A PDS4 Table_Delimited product label.
	 *
	 * @throws Exception If an error occurred during the label creation
	 * process.
	 */


/**
   * Transforms a PDS3 to a PDS4 label.
   *
   * @param pds3Label The PDS3 label to transform.
   * @param outputDir The output directory to place the PDS4 label.
   *
   * @return The PDS4 label.
   *
   * @throws TransformException If an error occurred while transforming
   *  the label.
   */


/**
   * Transforms the Record_Binary object into a Record_Delimited object.
   *
   * @param recordBinary The Record_Binary object to convert.
   *
   * @return The converted Record_Delimited object.
   */


/**
   * Transforms the fields and group fields. The top-level field objects of
   * ones containing packed fields are ignored as the Field_Bit objects
   * will be converted to Field_Delimited objects.
   *
   * @param fieldBinaries A list of fields and group fields to convert.
   *
   * @return A list of Field_Delimited and Group_Field_Delimited objects.
   */


/**
   * Converts Field_Binary objects to Field_Delimited objects.
   *
   * @param fieldBinary The Field_Binary object to convert.
   *
   * @return The converted Field_Delimited object.
   */


/**
   * Converts the Field_Bits within the Packed_Data_Fields to Field_Delimited
   * objects.
   *
   * @param packedDataFields The Packed_Data_Fields to convert.
   *
   * @return A list of converted Field_Delimited objects.
   */


/**
   * Converts the Group_Field_Binary object into a Group_Field_Delimited
   * object.
   *
   * @param groupFieldBinary The Group_Field_Binary object to convert.
   *
   * @return The converted Group_Field_Delimited object.
   */


/**
   * Converts a binary data type to an ascii data type.
   *
   * @param binaryType The data type to convert.
   *
   * @return An ascii data type.
   */


/**
   * Instantiates a new TableLabelTransformer object based on the given
   * table object.
   *
   * @param tableObject Must be either Table_Binary,
   * Table_Character, or Table_Delimited.
   *
   * @return a TableLabelTransformer object.
   *
   * @throws TransformException If the given object is not one of
   * the supported PDS4 table objects.
   */


/**
   * Transforms the Record_Character object into a Record_Delimited object.
   *
   * @param recordCharacter The Record_Character object to convert.
   *
   * @return The converted Record_Delimited object.
   */


/**
   * Transforms the fields and group fields.
   *
   * @param fieldCharacters A list of fields and group fields to convert.
   *
   * @return A list of Field_Delimited and Group_Field_Delimited objects.
   */


/**
   * Converts Field_Character objects to Field_Delimited objects.
   *
   * @param fieldCharacter The Field_Character object to convert.
   *
   * @return The converted Field_Delimited object.
   */


/**
   * Converts the Group_Field_Character object into a Group_Field_Delimited
   * object.
   *
   * @param groupFieldCharacter The Group_Field_Character object to convert.
   *
   * @return The converted Group_Field_Delimited object.
   */


/**
   * Write the given label to a file. It will use the file name
   * stored within the given Label object.
   *
   * @param label The label.
   *
   * @throws IOException If an error occurred while writing the
   * label to a file.
   */


/**
   * Convert a string to a URL.
   *
   * @param s The string to convert
   * @return A URL of the input string
   */


/**
	 * Lists the table and image objects currently supported by the Transform
	 * Tool. Report defaults to standard out.
	 *
	 * @param label The label to examine.
	 *
	 * @throws Exception If there was an error while parsing the label.
	 */


/**
	 * Lists the PDS3 objects supported by the tool.
	 *
	 * @param label The PDS3 label.
	 */


/**
	 * Lists the PDS4 objects supported by the tool.
	 *
	 * @param objectAccess Object representation of the PDS4 label.
	 * @param fileAreas A list of object representations of the file area
	 * element or elements within a given PDS4 label.
	 * @throws Exception
	 */


/**
	 * Prints the PDS4 image information.
	 *
	 * @param image Object representation of a PDS4 Array 2D image.
	 * @param index The index of the image.
	 */


/**
	 * Prints the PDS3 image information.
	 *
	 * @param image Object representation of a PDS3 image object.
	 * @param index The index of the image.
	 */


/**
	 * Prints the PDS4 table information.
	 *
	 * @param table Object representation of a PDS4 table.
	 * @param index The index of the table.
	 * @param fields A list of fields associated with the given table.
	 */


/**
   * Transcode the given input.
   *
   * @param input The input file.
   * @param output The output file.
   * @param format The format of the resulting transformation.
   * @param index The index of the image within the input file.
   * @param readAsRenderedImage 'true' to read the input as a rendered
   * image, 'false' otherwise.
   *
   * @throws TransformException If an error occurred transcoding
   * the input file.
   */


/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */


/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */


/**
	 * @return
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */


/**
     * Test of buildMap method, of class CustomRenderedImageMapOutputFormat.
     */


/**
     * Ensures the image is compatible with downstream image read operations
     * before generating the output stream. Specifically, it converts JAI
     * {@code TranslateIntOpImage} type images to a BufferedImage before calling
     * the delegate {@code formatImageOutputStream}.
     *
     * @param image The image to be transformed
     * @param outStream The output stream of the transformed image
     * @param mapContent
     * @throws ServiceException
     * @throws IOException
     */


/**
     * This overridden buildMap method ensures the image parameter is compatible
     * with ImageIO.read() prior to calling the super.buildMap method.
     *
     * @param mapContent
     * @param image
     * @return
     */


//    @Ignore ("TODO: Fix bean lookup")