isis/src/base/apps/isisminer/PdsTableFormatStrategy.cpp
int PdsTableFormatStrategy::validate(const QString &keynam, 
                                        SharedResource &definition, 
                                        const int &maxcols, const int &mincols,
                                        const bool &throwOnError) {
  
    int nvals = definition->count(keynam);
    if ( !((maxcols == nvals) || (mincols == nvals)) ) {
      if ( throwOnError ) {
        QString mess = "The keyword count [" + QString::number(nvals) + "] for the given " + keynam
                       + " Resource definition is invalid. Must equal maxcols [" 
                       + QString::number(maxcols) + "or mincols [" 
                       + QString::number(mincols) + "]."; 
        throw IException(IException::User, mess, _FILEINFO_);
      }
      return (-1);
    }
  
    // Has either maxcols or mincols
    return (nvals);
  }
/**
   * @brief Validates that the number of entries for a given 
   *        resource type is within the maximum and minimum values
   *        set.
   *
   * Validates that the number of entries for a given resource 
   * type is within the maximum and minimum values set. If 
   * throwOnError is true and the count of keynam is equal to 
   * maxcols or mincols, an error is thrown. If an error isn't 
   * thrown,validate returns the count of keynam if it is equal to
   * mincols or maxcols, otherwise -1 is returned. 
   *
   * @author 2012-07-15 Kris Becker
   *  
   * @param keynam A keyword that contains the name of a resource 
   *               type within definition.
   * @param definition PdsTableFormat Strategy PVL object 
   *                   definition
   * @param maxcols An int containing the maximum number of 
   *                columns.
   * @param mincols An int containing the minimum number of 
   *                columns.
   * @param throwOnError A boolean value that allows the user to 
   *                     determine if they want an error thrown if
   *                     certain conditions are met.
   *  
   * @return int Returns the count of keynam, if it is equal to
   *             mincols or maxcols. Otherwise an error is thrown or
   *             -1 is returned.
   * @throw IException::User "The keyword count for the given 
   *                   Resource definition is invalid. Must equal
   *                   maxcols or mincols."
   */
@brief Validates that the number of entries for a given
resource type is within the maximum and minimum values
set.

Validates that the number of entries for a given resource
type is within the maximum and minimum values set. If
throwOnError is true and the count of keynam is equal to
maxcols or mincols, an error is thrown. If an error isn't
thrown,validate returns the count of keynam if it is equal to
mincols or maxcols, otherwise -1 is returned.



@param keynam A keyword that contains the name of a resource
type within definition.
@param definition PdsTableFormat Strategy PVL object
definition
@param maxcols An int containing the maximum number of
columns.
@param mincols An int containing the minimum number of
columns.
@param throwOnError A boolean value that allows the user to
determine if they want an error thrown if
certain conditions are met.

@return int Returns the count of keynam, if it is equal to
mincols or maxcols. Otherwise an error is thrown or
-1 is returned.
@throw IException::User "The keyword count for the given
Resource definition is invalid. Must equal
maxcols or mincols."
@brief Validates that the number of entries for a given resource type is within the maximum and minimum values set . Validates that the number of entries for a given resource type is within the maximum and minimum values set . If throwOnError is true and the count of keynam is equal to maxcols or mincols an error is thrown . If an error isn ' t thrown validate returns the count of keynam if it is equal to mincols or maxcols otherwise - 1 is returned . @param keynam A keyword that contains the name of a resource type within definition . @param definition PdsTableFormat Strategy PVL object definition @param maxcols An int containing the maximum number of columns . @param mincols An int containing the minimum number of columns . @param throwOnError A boolean value that allows the user to determine if they want an error thrown if certain conditions are met . @return int Returns the count of keynam if it is equal to mincols or maxcols . Otherwise an error is thrown or - 1 is returned . @throw IException :: User " The keyword count for the given Resource definition is invalid . Must equal maxcols or mincols . "
int PdsTableFormatStrategy::validate(const QString &keynam, 
                                        SharedResource &definition, 
                                        const int &maxcols, const int &mincols,
                                        const bool &throwOnError) {
    int nvals = definition->count(keynam);
    if ( !((maxcols == nvals) || (mincols == nvals)) ) {
      if ( throwOnError ) {
        QString mess = "The keyword count [" + QString::number(nvals) + "] for the given " + keynam
                       + " Resource definition is invalid. Must equal maxcols [" 
                       + QString::number(maxcols) + "or mincols [" 
                       + QString::number(mincols) + "]."; 
        throw IException(IException::User, mess, _FILEINFO_);
      }
      return (-1);
    }
    return (nvals);
  }
int PdsTableFormatStrategy :: validate ( const QString & keynam , SharedResource & definition , const int & maxcols , const int & mincols , const bool & throwOnError ) { int nvals = definition -> count ( keynam ) ; if ( ! ( ( maxcols == nvals ) || ( mincols == nvals ) ) ) { if ( throwOnError ) { QString mess = " " + QString :: number ( nvals ) + " " + keynam + " " + QString :: number ( maxcols ) + " " + QString :: number ( mincols ) + " " ; throw IException ( IException :: User , mess , _FILEINFO_ ) ; } return ( -1 ) ; } return ( nvals ) ; }
@brief Validates that the number of entries for a given
        resource type is within the maximum and minimum values
        set.
@brief Validates that the number of entries for a given resource type is within the maximum and minimum values set .
// Has either maxcols or mincols