⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myreductexporter.cpp

📁 粗糙集应用软件
💻 CPP
字号:
//-------------------------------------------------------------------
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Revisions.....:
//===================================================================

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

#include <kernel/algorithms/myreductexporter.h>

#include <kernel/structures/reducts.h>
#include <kernel/structures/reduct.h>

#include <kernel/utilities/systemkit.h>

#include <kernel/system/fstream.h>

//-------------------------------------------------------------------
// Methods for class MyReductExporter.
//===================================================================

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

MyReductExporter::MyReductExporter() {
}

MyReductExporter::~MyReductExporter() {
}

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

IMPLEMENTIDMETHODS(MyReductExporter, MYREDUCTEXPORTER, ReductExporter)

//-------------------------------------------------------------------
// Methods inherited from Exporter.
//===================================================================

//-------------------------------------------------------------------
// Method........: ExportPrologue
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......: Consider using IOKit instead.
// Revisions.....:
//===================================================================

bool
MyReductExporter::ExportPrologue(ofstream &stream, const Structure &structure) const {

	// Cast to already verified type (in Apply method).
	Handle<Reducts> reducts = dynamic_cast(Reducts *, const_cast(Structure *, &structure));

	// Write some general information.
	stream << "% Reducts generated by ROSETTA." << endl;
	stream << "% Exported " << SystemKit::GetTimestamp() << " by " << SystemKit::GetUser() << "." << endl;
	stream << "%" << endl;
	stream << "% " << reducts->GetName() << endl;
	stream << "% " << reducts->GetNoReducts() << " reducts." << endl;
	stream << endl;

	return true;

}

//-------------------------------------------------------------------
// Methods inherited from ReductExporter.
//===================================================================

//-------------------------------------------------------------------
// Method........: ExportReduct
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Overloaded to deal with this syntax.
// Comments......:
// Revisions.....:
//===================================================================

bool
MyReductExporter::ExportReduct(ofstream &stream, int /*reduct_no*/, const Reduct &reduct) const {

	String formatted;

	bool masked = true;

	// Format reduct.
	if (!reduct.Format(formatted, GetDecisionTable(), masked)) {
		Message::Error("Error formatting reduct.");
		return false;
	}

	// Dump formatted reduct to file stream.
	stream << formatted << endl;

	// Dump support to file stream.
	stream << "Support = [" << reduct.GetSupport() << " subtable(s)]" << endl << endl;

	return true;

}

⌨️ 快捷键说明

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