filter.cpp

来自「粗糙集应用软件」· C++ 代码 · 共 109 行

CPP
109
字号
//-------------------------------------------------------------------
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Revisions.....:
//===================================================================

#include <stdafx.h> // Precompiled headers.
#include <copyright.h>

#include <kernel/algorithms/filter.h>
#include <kernel/algorithms/keyword.h>

#include <kernel/structures/structures.h>

#include <kernel/basic/message.h>

//-------------------------------------------------------------------
// Methods for class Filter.
//===================================================================

//-------------------------------------------------------------------
// Constructors/destructor.
//===================================================================

Filter::Filter() {
	InvertLogic(false);
}

Filter::~Filter() {
}

//-------------------------------------------------------------------
// Methods inherited from Identifier.
//===================================================================

IMPLEMENTIDMETHODS(Filter, FILTER, Algorithm)

//-------------------------------------------------------------------
// Methods inherited from Algorithm.
//===================================================================

//-------------------------------------------------------------------
// Method........: GetParameters
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......:
// Revisions.....:
//===================================================================

String
Filter::GetParameters() const {

	String parameters;

	parameters += Keyword::Invert();
	parameters += Keyword::Assignment();
	parameters += String::Format(InvertLogic());

	return parameters;

}

//-------------------------------------------------------------------
// Method........: SetParameter
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......:
// Revisions.....:
//===================================================================

bool
Filter::SetParameter(const String &keyword, const String &value) {

	if (keyword == Keyword::Invert() && value.IsBoolean())
		return InvertLogic(value.GetBoolean());

	return false;

}

//-------------------------------------------------------------------
// Method........: IsApplicable
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Returns true if the algorithm is applicable to the
//                 structure, false otherwise.
// Comments......:
// Revisions.....:
//===================================================================

bool
Filter::IsApplicable(const Structure &structure, bool /*warn*/) const {
	return structure.IsA(STRUCTURES);
}

//-------------------------------------------------------------------
// Method........: Apply
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Takes a structure set as input and filters it according
//                 to some (overloaded) filtering scheme.  By filtering is
//                 meant complete removal of individual member structures.
//
// Comments......: Assumes that library clients use handles.
//
// Revisions.....: A

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?