当前位置: 首页>>代码示例>>C++>>正文


C++ Alphabet::addSymbol方法代码示例

本文整理汇总了C++中Alphabet::addSymbol方法的典型用法代码示例。如果您正苦于以下问题:C++ Alphabet::addSymbol方法的具体用法?C++ Alphabet::addSymbol怎么用?C++ Alphabet::addSymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Alphabet的用法示例。


在下文中一共展示了Alphabet::addSymbol方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TableTest_resolveNotClosed

bool TableTest_resolveNotClosed() {
	// Table is not closed
	Alphabet a;
	a.addSymbol('0');
	a.addSymbol('1');
	
	// Figure 2
	ObservationTable table1;
	table1.addEntry("", "", true);
	table1.addEntry("0", "", false);
	table1.addEntry("1", "", false);
	
	table1.addStringToS("");
	table1.addStringToE("");
	
	if (table1.getS().count("0") != 0) {
		return false;
	}
	
	table1.resolveNotClosed(a);
	
	if (table1.getS().count("0") != 1) {
		return false;
	}

	return true;
}
开发者ID:vslehman,项目名称:regular-set-learner,代码行数:27,代码来源:table_test.cpp

示例2: TableTest_resolveNotConsistent

bool TableTest_resolveNotConsistent() {
	// Table is not consistent
	Alphabet a;
	a.addSymbol('0');
	a.addSymbol('1');
	
	// Figure 8
	ObservationTable table1;
	table1.addStringToS("");
	table1.addStringToS("0");
	table1.addStringToS("1");
	table1.addStringToS("11");
	table1.addStringToS("01");
	table1.addStringToS("011");
	
	table1.addStringToE("");
	table1.addStringToE("0");
	
	table1.addEntry("", "", true);
	table1.addEntry("", "0", false);
	table1.addEntry("0", "", false);
	table1.addEntry("0", "0", true);
	table1.addEntry("1", "", false);
	table1.addEntry("1", "0", false);
	table1.addEntry("11", "", true);
	table1.addEntry("11", "0", false);
	table1.addEntry("01", "", false);
	table1.addEntry("01", "0", false);
	table1.addEntry("011", "", false);
	table1.addEntry("011", "0", true);
	table1.addEntry("00", "", true);
	table1.addEntry("00", "0", false);
	table1.addEntry("10", "", false);
	table1.addEntry("10", "0", false);
	table1.addEntry("110", "", false);
	table1.addEntry("110", "0", true);
	table1.addEntry("111", "", false);
	table1.addEntry("111", "0", false);
	table1.addEntry("010", "", false);
	table1.addEntry("010", "0", false);
	table1.addEntry("0110", "", true);
	table1.addEntry("0110", "0", false);
	table1.addEntry("0111", "", false);
	table1.addEntry("0111", "0", false);
	
	if (table1.getE().count("1") != 0) {
		return false;
	}
	
	table1.resolveNotConsistent(a);
	
	if (table1.getE().count("1") != 1) {
		return false;
	}
	
	return true;
}
开发者ID:vslehman,项目名称:regular-set-learner,代码行数:57,代码来源:table_test.cpp

示例3: TableTest_isClosed

bool TableTest_isClosed() {
	
	// Table is not closed
	Alphabet a;
	a.addSymbol('0');
	a.addSymbol('1');
	
	// Figure 2
	ObservationTable table1;
	table1.addEntry("", "", true);
	table1.addEntry("0", "", false);
	table1.addEntry("1", "", false);
	
	table1.addStringToS("");
	table1.addStringToE("");
	
	if (table1.isClosed(a)) {
		std::cout << "Closed" << std::endl;
		return false;
	}
	
	// Table is closed
	// Figure 3
	ObservationTable table2;
	table2.addEntry("", "", true);
	table2.addEntry("0", "", false);
	table2.addEntry("1", "", false);
	table2.addEntry("00", "", true);
	table2.addEntry("01", "", false);
	
	table2.addStringToS("");
	table2.addStringToS("0");
	table2.addStringToE("");
	
	if (!table2.isClosed(a)) {
		return false;
	}
	
	return true;
	
}
开发者ID:vslehman,项目名称:regular-set-learner,代码行数:41,代码来源:table_test.cpp

示例4: TableTest_isConsistent

bool TableTest_isConsistent() {
	
	
	// Table is not consistent
	Alphabet a;
	a.addSymbol('0');
	a.addSymbol('1');
	
	// Figure 8
	ObservationTable table1;
	table1.addStringToS("");
	table1.addStringToS("0");
	table1.addStringToS("1");
	table1.addStringToS("11");
	table1.addStringToS("01");
	table1.addStringToS("011");
	
	table1.addStringToE("");
	table1.addStringToE("0");
	
	table1.addEntry("", "", true);
	table1.addEntry("", "0", false);
	table1.addEntry("0", "", false);
	table1.addEntry("0", "0", true);
	table1.addEntry("1", "", false);
	table1.addEntry("1", "0", false);
	table1.addEntry("11", "", true);
	table1.addEntry("11", "0", false);
	table1.addEntry("01", "", false);
	table1.addEntry("01", "0", false);
	table1.addEntry("011", "", false);
	table1.addEntry("011", "0", true);
	table1.addEntry("00", "", true);
	table1.addEntry("00", "0", false);
	table1.addEntry("10", "", false);
	table1.addEntry("10", "0", false);
	table1.addEntry("110", "", false);
	table1.addEntry("110", "0", true);
	table1.addEntry("111", "", false);
	table1.addEntry("111", "0", false);
	table1.addEntry("010", "", false);
	table1.addEntry("010", "0", false);
	table1.addEntry("0110", "", true);
	table1.addEntry("0110", "0", false);
	table1.addEntry("0111", "", false);
	table1.addEntry("0111", "0", false);
	
	if (table1.isConsistent(a)) {
		std::cout << "Consistent" << std::endl;
		return false;
	}
	
	// Table is Consistent
	ObservationTable table2;
	table2.addEntry("", "", true);
	table2.addEntry("0", "", false);
	table2.addEntry("1", "", false);
	table2.addEntry("01", "", false);
	
	if (!table2.isConsistent(a)) {
		return false;
	}
	
	return true;
}
开发者ID:vslehman,项目名称:regular-set-learner,代码行数:65,代码来源:table_test.cpp


注:本文中的Alphabet::addSymbol方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。