|
STK++ 1.0
|
00001 /*--------------------------------------------------------------------*/ 00002 /* Copyright (C) 2004-2011 Serge Iovleff 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU Lesser General Public License as 00006 published by the Free Software Foundation; either version 2 of the 00007 License, or (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this program; if not, write to the 00016 Free Software Foundation, Inc., 00017 59 Temple Place, 00018 Suite 330, 00019 Boston, MA 02111-1307 00020 USA 00021 00022 Contact : Serge.Iovleff@stkpp.org 00023 */ 00024 00025 /* 00026 * Project: stkpp::reduct 00027 * created on: 11 juil. 2011 00028 * Purpose: implement the utilities for the project reduct. 00029 * Author: iovleff, serge.iovleff@stkpp.org 00030 * 00031 **/ 00032 00037 #include "../include/STK_Reduct_Util.h" 00038 #include "../../STKernel/include/STK_String_Util.h" 00039 00040 namespace STK 00041 { 00042 00043 namespace Reduct 00044 { 00045 00046 /* convert a String to a TypeReduction. 00047 * @param type the type of reduction we want to define 00048 * @return the TypeReduction represented by the String @c type. if the string 00049 * does not match any known name, the @c unknown_ type is returned. 00050 **/ 00051 TypeReduction StringToTypeReduction( String const& type) 00052 { 00053 if (toUpperString(type) == toUpperString(_T("totalVariance"))) return totalVariance_; 00054 if (toUpperString(type) == toUpperString(_T("localVariance"))) return localVariance_; 00055 if (toUpperString(type) == toUpperString(_T("mds"))) return mds_; 00056 return unknown_; 00057 } 00058 00059 /* convert a TypeReduction to a String. 00060 * @param type the type of reduction we want to convert 00061 * @return the string associated to this type. 00062 **/ 00063 String TypeReductionToString( TypeReduction const& type) 00064 { 00065 if (type == totalVariance_) return String(_T("totalVariance")); 00066 if (type == localVariance_) return String(_T("localVariance")); 00067 if (type == mds_) return String(_T("mds")); 00068 return String(_T("unknown")); 00069 } 00070 00071 } // namespace Regress 00072 00073 } // namespace STK