📄 binarysplitter.cpp
字号:
//-------------------------------------------------------------------
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Revisions.....:
//===================================================================
#include <stdafx.h> // Precompiled headers.
#include <copyright.h>
#include <kernel/algorithms/binarysplitter.h>
#include <kernel/algorithms/keyword.h>
#include <kernel/structures/decisiontable.h>
#include <kernel/structures/decisiontables.h>
#include <kernel/structures/dictionary.h>
#include <kernel/structures/attribute.h>
#include <kernel/utilities/rng.h>
#include <kernel/utilities/mathkit.h>
#include <kernel/utilities/creator.h>
#include <kernel/basic/message.h>
//-------------------------------------------------------------------
// Methods for class BinarySplitter.
//===================================================================
//-------------------------------------------------------------------
// Constructors/destructor.
//===================================================================
BinarySplitter::BinarySplitter() {
SetSeed(1);
SetSplittingFactor(0.5);
}
BinarySplitter::~BinarySplitter() {
}
//-------------------------------------------------------------------
// Methods inherited from Identifier.
//===================================================================
IMPLEMENTIDMETHODS(BinarySplitter, BINARYSPLITTER, Splitter)
//-------------------------------------------------------------------
// Methods inherited from Algorithm.
//===================================================================
//-------------------------------------------------------------------
// Method........: GetParameters
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......:
// Revisions.....:
//===================================================================
String
BinarySplitter::GetParameters() const {
String parameters;
parameters += Keyword::Seed();
parameters += Keyword::Assignment();
parameters += String::Format(GetSeed());
parameters += Keyword::Separator();
parameters += Keyword::Factor();
parameters += Keyword::Assignment();
parameters += String::Format(GetSplittingFactor());
parameters += Keyword::Separator();
parameters += Splitter::GetParameters();
return parameters;
}
//-------------------------------------------------------------------
// Method........: SetParameter
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Comments......:
// Revisions.....:
//===================================================================
bool
BinarySplitter::SetParameter(const String &keyword, const String &value) {
if (keyword == Keyword::Seed() && value.IsInteger())
return SetSeed(value.GetInteger());
if (keyword == Keyword::Factor() && value.IsFloat())
return SetSplittingFactor(value.GetFloat());
return Splitter::SetParameter(keyword, value);
}
//-------------------------------------------------------------------
// Method........: Apply
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Takes a decision table as input and splits it
// in two according to some splitting scheme.
//
// If specified, the resulting subtables are appended
// to the input table as children, and the input table
// itself is returned. Alternatively, the subtables are
// not appended as children, but are instead returned as
// a decision table set.
//
// Comments......: Assumes that library clients use handles.
// Revisions.....: A
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -