亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rsesrules.cpp

?? 粗慥集成算法集合 ,并有詳細的文檔資料和測試數據處
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
//-------------------------------------------------------------------
// Author........: Aleksander 豩rn
// Date..........:
// Description...: The data logically belonging to the RSESRules
//                 object may physically "belong" to the parent
//                 RSESReducts object.
// Revisions.....:
//===================================================================

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

#include <kernel/rses/structures/rsesrules.h>
#include <kernel/rses/structures/rsesrule.h>

#include <kernel/rses/library/trule.h>
#include <kernel/rses/library/treduct.h>
#include <kernel/rses/library/trr_mem.h>
#include <kernel/rses/library/err.h>

#include <kernel/utilities/creator.h>

#include <kernel/basic/message.h>

//-------------------------------------------------------------------
// Methods for class RSESRules.
//===================================================================

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

//-------------------------------------------------------------------
// Method........: Copy constructor
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......: Deep or shallow pointer copy?
// Revisions.....:
//===================================================================

RSESRules::RSESRules(const RSESRules &in) : Rules(in) {
	rules_ = in.rules_;
	is_owner_ = false;
}

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

RSESRules::RSESRules() {
	rules_ = NULL;
	is_owner_ = false;
}

//-------------------------------------------------------------------
// Method........: Destructor
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......: Note that a call to Clear() assumes that a set of
//                 RSES reducts only supports one rule set as a child,
//                 something that is presently true due to the current
//                 status of the RSES library.
//
//                 Embedded TRedRulMem object is typically "owned" by
//                 the parent reduct set.
// Revisions.....:
//===================================================================

RSESRules::~RSESRules() {

	// Remove all rules.
	RemoveAllStructures();

	if (is_owner_)
		delete rules_;

}

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

IMPLEMENTIDMETHODS(RSESRules, RSESRULES, Rules)

//-------------------------------------------------------------------
// Methods inherited from Persistent.
//===================================================================

//-------------------------------------------------------------------
// Method........: Load
// Author........: Aleksander 豩rn
// Date..........:
// Description...: A RSESRules object doesn't necessarily per se contain
//                 any data, the (embedded) data may "belong" to
//                 the parent RSESReducts object.
//
//                 Should find a way to deal with this properly, so that
//                 one can logically save only a set of rules...
//
// Comments......: BUG: Does not load any children! Should call
//                      ParentStructure::Load instead!
//
// Revisions.....:
//===================================================================

bool
RSESRules::Load(ifstream &stream) {

	// Load stuff higher up.
	if (!AnnotatedStructure::Load(stream))
		return false;

	return true;

}

//-------------------------------------------------------------------
// Method........: Save
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......: Cf. comments of corresponding Load method.
//
//                 BUG: Does not save any children! Should call
//                      ParentStructure::Save instead!
//
// Revisions.....:
//===================================================================

bool
RSESRules::Save(ofstream &stream) const {

	// Save stuff higher up.
	if (!AnnotatedStructure::Save(stream))
		return false;

	if (is_owner_)
		Message::Warning("Set of RSES rules (" + GetName() + ") not saved.");

	if (HasChildren())
		Message::Warning("Children of \"" + GetName() + "\" not saved.", false);

	return true;

}

//-------------------------------------------------------------------
// Methods inherited from Structure.
//===================================================================

//------------------------------------------------------------------
// Method........: Duplicate
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......: Duplication of embedded RSES rules is not really
//                 done, only wrappers are duplicated.  This
//                 method should therefore be used with utmost care.
//
//                 The only reason this method does not return NULL
//                 by default, is so that the Creator can create
//                 "virgin" RSESRules objects.  The number of wrappers
//                 is then 0, so it really doesn't matter in that
//                 particular case.
// Revisions.....:
//===================================================================

Structure *
RSESRules::Duplicate() const {

	// Is duplication possible?
	if (GetNoStructures() > 0) {
		Message::Error("Non-empty RSES rule sets cannot be duplicated.\n"
			             "Duplicate the parent RSES reduct set instead.");
		return NULL;
	}

	return new RSESRules(*this);

}

//------------------------------------------------------------------
// Method........: Clear
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......: Note that this affects the embedded object of the
//                 (wrapperwise logically independent) parent RSES
//                 reduct set.  Use therefore this method with utmost
//                 care.
// Revisions.....:
//===================================================================

void
RSESRules::Clear() {
	RemoveAllStructures();
}

//-------------------------------------------------------------------
// Methods inherited from Structures.
//===================================================================

//------------------------------------------------------------------
// Method........: InsertStructure
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Overloaded to check for consistency/homogenity.
//                 Ensures that only RSES rules are inserted.  Also,
//                 checks their reduct origins.
//
// Comments......: AppendStructure is not necessary to overload, since
//                 Structures::AppendStructure is implemented via the
//                 InsertStructure method.
//
//                 Having to check membership in the embedded TRedRulMem
//                 is very inefficient.
// Revisions.....:
//===================================================================

bool
RSESRules::InsertStructure(Structure *structure, int i) {

	// Valid input?
	if (structure == NULL) {
		Message::Error("Cannot insert a NULL rule.");
		return false;
	}

	// Structure of correct type?
	if (!structure->IsA(RSESRULE)) {
		Message::Error("Cannot insert a non-RSES rule into a RSES rule set.");
		return false;
	}

	// Cast to verified type.
	Handle<RSESRule> rule = dynamic_cast(RSESRule *, structure);

	// Get originating RSES reduct.
	TReduct *rsesreduct = rule->reduct_;

	if (rsesreduct == NULL) {
		Message::Error("The RSES reduct embedded in the RSES rule is NULL.");
		return false;
	}

	// Is there a TRedRulMem object to insert into?
	if (rules_ == NULL) {
		Message::Error("The embedded RSES reduct and rule memory is NULL.");
		return false;
	}

	int position = Undefined::Integer();

	// Is the originating RSES reduct a member of the embedded reduct and rule memory?
	try {

		int i, no_reducts = rules_->NoReducts();

		// Locate position index, if present.
		for (i = no_reducts - 1; i >= 0; i--) {
			if (rules_->GetRed(i) == rsesreduct) {
				position = i;
				break;
			}
		}

	}

	// Catch any RSES exceptions.
	catch (Error &error) {
		Message::RSESError("Error accessing embedded TRedRulMem object.", error.GetMessage());
		return false;
	}

	bool is_member = (position != Undefined::Integer());

	// If the originating RSES reduct was not a member, add it.
	if (!is_member) {
		Message::Error("Addition of non-member RSESReduct not implemented yet.\n"
		               "Not yet determined how to handle associated rules, if more than one.");
		return false;
	}

	// We've already verified TRedRulMem membership and consistency.
	bool verify = false;

	return InsertRule(rule.GetPointer(), i, *rsesreduct, verify, position);

}

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

bool
RSESRules::RemoveStructure(int i) {

	// Get the rule wrapper to remove.
	Handle<RSESRule> rule = dynamic_cast(RSESRule *, GetStructure(i));

	if (rule == NULL) {
		Message::Error("Unable to acquire rule to remove.");
		return false;
	}

	// Get the originating RSES reduct.
	TReduct *reduct = rule->reduct_;

	if (reduct == NULL) {
		Message::Error("Unable to acquire originating reduct of rule to remove.");
		return false;
	}

	int position = Undefined::Integer();

	// Remove the embedded rule from the embedded reduct.
	try {

		int i, no_rules = reduct->NoRules();

		// Find out in which position in the embedded reduct the embedded rule lies.
		for (i = 0 ; i < no_rules; i++) {
			if (reduct->GetRule(i) == rule->rule_) {
				position = i;
				break;
			}
		}

		// Was a position index found?
		if (position == Undefined::Integer()) {
			Message::Error("The embedded rule could not be found as a child of the embedded parent reduct.");
			return false;
		}

		// Do the removal.
		reduct->RemoveRule(position);

	}

	// Catch any RSES exceptions.
	catch (Error &error) {
		Message::RSESError("Error accessing the embedded RSES library objects.", error.GetMessage());
		return false;
	}

	// Remove the rule wrapper.
	if (!Structures::RemoveStructure(i)) {
		Message::Error("Error removing rule wrapper from structure set.");
		return false;
	}

	return true;

}

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

bool
RSESRules::RemoveAllStructures() {

	// Remove all wrappers.
	if (!Structures::RemoveAllStructures()) {
		Message::Error("Failed to remove all wrapper structures.");
		return false;
	}

	// Does the embedded reduct and rule memory exist?
	if (rules_ == NULL)
		return true;

	// Do the clearing.
	try {
    rules_->ClearRules();
	}
	catch (Error &error) {
		Message::RSESError("Error clearing rules from parent reduct set's embedded RSES reduct and rule memory.", error.GetMessage());
		return false;
	}

	return true;

}

//-------------------------------------------------------------------
// Methods inherited from Rules.
//===================================================================

//-------------------------------------------------------------------
// Method........: Sort
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......: Sorts the wrappers only.
// Revisions.....:
//===================================================================

bool
RSESRules::Sort(int property, bool ascending, const Handle<DecisionTable> table) {
	return Rules::Sort(property, ascending, table);
}

//-------------------------------------------------------------------
// Local methods.
//===================================================================

//------------------------------------------------------------------
// Method........: GetNoRules
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Returns the number of rules in the rule set that
//                 are derived from the specified reduct (i.e. have
//                 the specified reduct as a parent).
//
// Comments......: Inefficient initial implementation, optimize.
// Revisions.....:
//===================================================================

int
RSESRules::GetNoRules(const TReduct &rsesreduct, int index) const {

	if (rules_ == NULL)
		return 0;

#ifdef _DEBUG
	bool is_member = false;

	// Is the input reduct really a member of the parent reduct set?  If so, all
	// embedded rules of the input reduct are assumed to be (embedded) members of
	// this rule set.
	try {

		int i, no_reducts = rules_->NoReducts();

		// Check suggested index, if given.
		if (index >= 0 && index < no_reducts)
			is_member = (rules_->GetRed(index) == &rsesreduct);

		// Scan through all reducts if suggested index failed.
		if (!is_member) {
			for (i = no_reducts - 1; i >= 0; i--) {
				if (rules_->GetRed(i) == &rsesreduct) {
					is_member = true;
					break;
				}
			}
		}

	}

	// Catch any RSES exceptions.
	catch (Error &error) {
		Message::RSESError("Error accessing embedded RSES object.", error.GetMessage());
		return 0;
	}

	if (!is_member) {
		Message::Error("Argument reduct is not a member of the parent RSES reduct set.");
		return 0;
	}
#endif

	// Return the number of rules associated with the input reduct.
	// For some reason, TReduct::NoRules is not a const method...
	try {
		return const_cast(TReduct &, rsesreduct).NoRules();
	}
	catch (Error &error) {
		Message::RSESError("Error accessing embedded RSES reduct.", error.GetMessage());
		return 0;
	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久成人免费网站| 久久在线观看免费| 精品捆绑美女sm三区| 国产精品美女久久久久aⅴ国产馆| 一区二区三区欧美久久| 国产自产2019最新不卡| 欧美精品久久久久久久久老牛影院| 国产欧美一区二区三区在线看蜜臀 | 中文字幕亚洲欧美在线不卡| 麻豆久久一区二区| 欧美午夜精品免费| 国产精品久久久久久亚洲毛片| 久久精品久久99精品久久| 欧美日韩大陆在线| 亚洲靠逼com| 国产xxx精品视频大全| 欧美成人乱码一区二区三区| 亚洲成av人片| 在线精品视频一区二区三四| 自拍偷拍国产精品| 成人av网址在线| 国产亚洲精品久| 老司机精品视频在线| 日韩一卡二卡三卡四卡| 日韩黄色在线观看| 7777精品伊人久久久大香线蕉的 | 日韩高清在线一区| 欧美日韩午夜精品| 午夜精品福利视频网站| 在线看不卡av| 亚洲高清在线精品| 欧美日韩大陆一区二区| 天天影视网天天综合色在线播放| 欧美人牲a欧美精品| 日本亚洲电影天堂| 欧美电视剧在线观看完整版| 九九精品一区二区| 久久免费国产精品| 成人app在线观看| 亚洲美女视频在线| 欧美酷刑日本凌虐凌虐| 日韩成人一区二区三区在线观看| 在线综合亚洲欧美在线视频| 日本欧美一区二区| 久久婷婷久久一区二区三区| 国产凹凸在线观看一区二区| 亚洲视频一区在线观看| 欧美日韩综合一区| 美脚の诱脚舐め脚责91| 久久久久久99精品| 色偷偷88欧美精品久久久| 亚洲不卡在线观看| 精品福利二区三区| 91影院在线免费观看| 亚洲一二三区在线观看| 欧美成人精品二区三区99精品| 国产乱国产乱300精品| 最新热久久免费视频| 欧美美女喷水视频| 国产精品99久久久久久久女警 | 美女一区二区三区| 国产精品午夜久久| 欧美日韩mp4| 国产mv日韩mv欧美| 亚洲国产精品视频| 国产欧美日韩在线看| 精品视频1区2区3区| 国产乱码精品1区2区3区| 一区二区三区小说| 精品国产区一区| 在线精品视频免费播放| 国内精品久久久久影院色| 亚洲三级在线看| 精品精品欲导航| 欧美综合久久久| 国产福利91精品一区| 日韩成人伦理电影在线观看| 中文字幕一区二区在线播放| 欧美一区二区观看视频| 91污片在线观看| 国产剧情一区二区| 日日摸夜夜添夜夜添精品视频 | 91社区在线播放| 韩国女主播一区| 亚洲午夜精品在线| 国产欧美视频一区二区三区| 777久久久精品| 91国内精品野花午夜精品| 国产呦萝稀缺另类资源| 石原莉奈在线亚洲二区| 最好看的中文字幕久久| 久久男人中文字幕资源站| 制服.丝袜.亚洲.另类.中文| 一本大道久久a久久综合 | 国产精品一级在线| 欧美a一区二区| 亚洲一区日韩精品中文字幕| 中文字幕日韩精品一区| 久久女同互慰一区二区三区| 欧美岛国在线观看| 91精品国产欧美一区二区成人| 在线观看日韩一区| 91麻豆蜜桃一区二区三区| 粉嫩av一区二区三区| 久久er99热精品一区二区| 亚洲国产毛片aaaaa无费看| 一区二区三区中文在线观看| 日韩伦理免费电影| 成人免费一区二区三区视频 | 精品成a人在线观看| 日韩欧美中文一区| 欧美一区二区三区啪啪| 欧美一区二区三区精品| 欧美成人精品高清在线播放| 日韩一级片在线播放| 日韩视频中午一区| 精品盗摄一区二区三区| 久久综合色8888| 久久久久久免费网| 久久中文字幕电影| 国产婷婷色一区二区三区四区| 国产日韩精品一区| 国产精品久久久久婷婷二区次| 国产精品理论片| 亚洲色图都市小说| 亚洲一区二区五区| 日韩高清不卡一区二区三区| 日本成人在线看| 韩国av一区二区三区四区| 国产高清精品网站| 91丝袜美腿高跟国产极品老师 | 成人精品亚洲人成在线| 成人激情文学综合网| 91美女福利视频| 欧美三日本三级三级在线播放| 欧美人妇做爰xxxⅹ性高电影| 欧美一区二区三区的| 久久夜色精品国产噜噜av| 国产精品黄色在线观看| 午夜欧美在线一二页| 紧缚奴在线一区二区三区| 成人黄色在线看| 欧美日韩一区二区三区视频| 欧美成人精品福利| 亚洲人成亚洲人成在线观看图片 | 欧美日韩国产首页在线观看| 日韩精品一区二区在线| 国产精品成人一区二区艾草| 亚洲国产精品久久艾草纯爱| 国内精品伊人久久久久影院对白| www.亚洲在线| 欧美电影免费观看高清完整版| 国产精品欧美一级免费| 日韩二区三区四区| 春色校园综合激情亚洲| 欧美日本免费一区二区三区| 欧美高清在线精品一区| 日韩在线播放一区二区| 国产99久久久国产精品免费看 | 91在线播放网址| 这里只有精品电影| 综合激情成人伊人| 激情另类小说区图片区视频区| 色综合天天综合网国产成人综合天| 欧美丰满高潮xxxx喷水动漫| 国产精品欧美经典| 捆绑调教美女网站视频一区| 一本一道波多野结衣一区二区| 欧美刺激午夜性久久久久久久| 亚洲男人的天堂网| 国产凹凸在线观看一区二区| 91精品国产91久久久久久最新毛片| 亚洲欧美日韩人成在线播放| 国产高清亚洲一区| 日韩免费在线观看| 亚洲成人资源网| 色综合久久久久综合体桃花网| 久久午夜色播影院免费高清| 免费精品视频最新在线| 欧美三级在线播放| 亚洲欧美日韩中文播放| 国产98色在线|日韩| wwwwxxxxx欧美| 久久精品国产**网站演员| 4438x成人网最大色成网站| 亚洲精选免费视频| 色婷婷亚洲婷婷| 亚洲私人黄色宅男| 不卡视频一二三四| 国产精品美女一区二区在线观看| 国产美女视频一区| 日韩色视频在线观看| 日韩激情中文字幕| 91精品国产一区二区人妖| 午夜久久电影网| 欧美麻豆精品久久久久久| 三级欧美韩日大片在线看| 91精品国模一区二区三区| 日韩福利视频导航| 精品少妇一区二区三区日产乱码|