📄 selector.cpp
字号:
/* Context : Fuzzy Clustering Algorithms Author : Frank Hoeppner, see also AUTHORS file Description : implementation of class module Selector History : selector.nw $Id:$ Comment : This file was generated automatically. DO NOT EDIT. Copyright : Copyright (C) 1999-2000 Frank Hoeppner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*//* The University of Applied Sciences Oldenburg/Ostfriesland/Wilhelmshaven hereby disclaims all copyright interests in the program package `fc' (tool package for fuzzy cluster analysis) written by Frank Hoeppner. Prof. Haass, President of Vice, 2000-Mar-10*/#ifndef Selector_SOURCE#define Selector_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif// necessary includes#include "Selector.hpp"#include "trace.hpp"#include "ustream-d.hpp"// dataconst char g_selector_names[SELECT_END][5] = { "zero","one","time","data", "prot","npro","attr","delt","weig","memb","pmem","dist","sidi","side", "hlev","valm","mone" };const char g_selector_description[SELECT_END][50] = { "","","time", "data vector","prototypes","no. of prototypes","feature attribute", "feature delta","weights","membership degrees", "powered membership degrees times weight", "distance","side distance","side degree","hierarchy level", "validity measure","minus one"};const int g_selector_args[SELECT_END] = {0,0,0,0,0,0,1,1,0,1,1,2,2,2,0,0,0};// implementationSelector::Selector ( const char * p_ident ) { if (p_ident == NULL) { m_type = SELECT_ZERO; } else { istrstream stream(p_ident,strlen(p_ident)); read(stream); } }Selector::Selector ( int a_type, int a_index1, int a_index2 ) : m_type(a_type) { invariant((a_type>=SELECT_BEGIN) && (a_type<=SELECT_END), "known selector type chosen",SOURCELOC); m_index[0] = a_index1; m_index[1] = a_index2; }const char* Selector::get_description ( ) const { return g_selector_description[ m_type ]; }int Selector::get_type ( ) const { return m_type; }voidSelector::read ( istream& is ) { m_type = SELECT_BEGIN; while ( (m_type!=SELECT_END) && (!is_followed_by(is,g_selector_names[m_type],false)) ) { ++m_type; } if (m_type==SELECT_END) { error("unkown selector type. Aborting.",SOURCELOC); exit(-1); } for (int i=0;i<g_selector_args[m_type];++i) { if (is_followed_by(is,":",false)) { is >> m_index[i]; } else { m_index[i] = -1; // default value for missing parameter } } }voidSelector::write ( ostream& os ) const { os << g_selector_names[m_type]; for (int i=0;i<g_selector_args[m_type];++i) os << ":" << m_index[i]; }bool Selector::operator== ( const Selector& a_selector ) const { bool same( m_type == a_selector.m_type ); for (int i=0;i<g_selector_args[m_type];++i) { same &= (m_index[i]==a_selector.m_index[i]); } return same; }// template instantiation#endif // Selector_SOURCE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -