// file: $isip_ifc/class/algo/CorrelationDimension/cdim_00.cc
// version: $Id: cdim_00.cc 10555 2006-04-19 08:39:03Z pannuri $
//

// isip include files
//
#include "CorrelationDimension.h"
 
//------------------------------------------------------------------------
//
// required public methods
//
//-----------------------------------------------------------------------

// method: assign
//
// arguments:
//  const CorrelationDimension& arg: (input) object to assign
//
// return: a boolean value indicating status
//
// this method assigns the input object to current object
//
boolean CorrelationDimension::assign(const CorrelationDimension& arg_a) {

  // assign all protected data
  //
  algorithm_d = arg_a.algorithm_d;
  implementation_d = arg_a.implementation_d;
  scaling_d = arg_a.scaling_d;
  epsilon_min_d = arg_a.epsilon_min_d;
  epsilon_max_d = arg_a.epsilon_max_d;
  epsilon_res_d = arg_a.epsilon_res_d; 
  delta_d = arg_a.delta_d;
  theiler_correction_d = arg_a.theiler_correction_d;
  
  // call the base assign method:
  //  note that the base class assign method sets the initialization flag
  //
  return AlgorithmBase::assign(arg_a);
}

// method: eq
//
// arguments:
//  const CorrelationDimension& arg: (input) input object to assign
//
// return: a boolean value indicating status
//
// this method checks whether the current object is identical to the
// input object
//
boolean CorrelationDimension::eq(const CorrelationDimension& arg_a) const {

  // compare all protected data
  //
  return ((algorithm_d == arg_a.algorithm_d) &&
	  (implementation_d == arg_a.implementation_d) &&
	  (scaling_d == arg_a.scaling_d) &&
	  (epsilon_min_d == arg_a.epsilon_min_d) &&
	  (epsilon_max_d == arg_a.epsilon_max_d) &&
	  (epsilon_res_d == arg_a.epsilon_res_d) &&
	  (delta_d == arg_a.delta_d)&&
	  (theiler_correction_d == arg_a.theiler_correction_d));
}

// method: clear
//
// arguments:
//  Integral::CMODE ctype: (input) clear mode
//
// return: a boolean value indicating status
//
// this method resets the data members to the default values
//
boolean CorrelationDimension::clear(Integral::CMODE ctype_a) {

  // reset all protected data
  //
  if (ctype_a != Integral::RETAIN) {
    algorithm_d = DEF_ALGORITHM;
    implementation_d = DEF_IMPLEMENTATION;
    scaling_d = DEF_SCALING;
    epsilon_min_d = DEF_EPSILON_MIN;
    epsilon_max_d = DEF_EPSILON_MAX;
    epsilon_res_d = DEF_EPSILON_RES;
    delta_d = DEF_DELTA;
    theiler_correction_d = DEF_THEILER_CORRECTION;
  }
  
  // call the base clear method
  //
  return AlgorithmBase::clear(ctype_a);
}

//---------------------------------------------------------------------------
//
// class-specific public methods:
//  public methods required by the AlgorithmBase interface contract
//
//---------------------------------------------------------------------------

// method: assign
//
// arguments:
//  const AlgorithmBase& arg: (input) object to be assigned
//
// return: a boolean value indicating status
//
// this method assigns the input algorithm object to the current
// CorrelationDimension object. if the input algorithm object is not a CorrelationDimension
// object, it errors.
//
boolean CorrelationDimension::assign(const AlgorithmBase& arg_a) {

  if (typeid(arg_a) == typeid(CorrelationDimension)) {
    return assign((CorrelationDimension&)arg_a);
  }
  else {
    return Error::handle(name(), L"assign", Error::ARG, __FILE__, __LINE__);
  }
}

// method: eq
//
// arguments:
//  const AlgorithmBase& arg: (input) object to be compared
//
// return: a boolean value indicating status
//
// this method checks whether the current CorrelationDimension object is identical
// to the input algorithm object. if the input algorithm object is not
// a CorrelationDimension object, it errors.
//
boolean CorrelationDimension::eq(const AlgorithmBase& arg_a) const {
  
  if (typeid(arg_a) == typeid(CorrelationDimension)) {
    return eq((CorrelationDimension&)arg_a);
  }
  else {
    return Error::handle(name(), L"eq", Error::ARG, __FILE__, __LINE__);
  }
}

//-----------------------------------------------------------------------------
//
// we define non-integral constants in the default constructor
//      
//-----------------------------------------------------------------------------

// constants: class name
//
const String CorrelationDimension::CLASS_NAME(L"CorrelationDimension");

// constants: i/o related constants
//
const String CorrelationDimension::DEF_PARAM(L"");
const String CorrelationDimension::PARAM_ALGORITHM(L"algorithm");
const String CorrelationDimension::PARAM_IMPLEMENTATION(L"implementation");
const String CorrelationDimension::PARAM_SCALING(L"scaling");
const String CorrelationDimension::PARAM_EPSILON_MIN(L"epsilon_min");
const String CorrelationDimension::PARAM_EPSILON_MAX(L"epsilon_max");
const String CorrelationDimension::PARAM_EPSILON_RES(L"epsilon_res");
const String CorrelationDimension::PARAM_DELTA(L"delta");
const String CorrelationDimension::PARAM_THEILER_CORRECTION(L"theiler_correction");

// constants: NameMap(s) for the enumerated values
//
const NameMap CorrelationDimension::ALGO_MAP(L"NORMAL");
const NameMap CorrelationDimension::IMPL_MAP(L"BACKWARD, CENTRAL, SMOOTH");
const NameMap CorrelationDimension::SCAL_MAP(L"LINSCALE, LOGSCALE");

// static instantiations: memory manager
//
MemoryManager CorrelationDimension::mgr_d(sizeof(CorrelationDimension), CorrelationDimension::name());
