本文整理汇总了C++中setNode函数的典型用法代码示例。如果您正苦于以下问题:C++ setNode函数的具体用法?C++ setNode怎么用?C++ setNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setNode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_setNode_given_10_20_30_node20_as_root_should_return_expected_tree
/*
* node20(20)
* / \
* node10(10) node30(30)
*/
void test_setNode_given_10_20_30_node20_as_root_should_return_expected_tree(void)
{
setNode(0, 10, NULL, NULL, &node10);
setNode(0, 30, NULL, NULL, &node30);
setNode(0, 20, &node10, &node30, &node20);
TEST_ASSERT_EQUAL_TREE(0, 20, &node10, &node30, &node20);
}
开发者ID:LouiseSiah,项目名称:AVL,代码行数:12,代码来源:test_Node.c
示例2: h
OSGTextNode::OSGTextNode(QObject *parent) :
osgQtQuick::OSGNode(parent),
h(new Hidden)
{
osg::ref_ptr<osgText::Font> textFont = createFont(QFont("Times"));
h->text = createText(osg::Vec3(-100, 20, 0),
"The osgQtQuick :-)\n"
"И даже по русски!",
20.0f,
textFont.get());
osg::ref_ptr<osg::Geode> textGeode = new osg::Geode();
h->text->setColor(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f));
textGeode->addDrawable(h->text.get());
#if 0
h->text->setAutoRotateToScreen(true);
setNode(textGeode.get());
#else
osg::Camera *camera = createHUDCamera(-100, 100, -100, 100);
camera->addChild(textGeode.get());
camera->getOrCreateStateSet()->setMode(
GL_LIGHTING, osg::StateAttribute::OFF);
setNode(camera);
#endif
}
开发者ID:Indianberries,项目名称:LibrePilot,代码行数:25,代码来源:OSGTextNode.cpp
示例3: test_removeNextLargerSuccessor_given_nodes_1_4_5_6_7_8_10_13_15_20_should_remove_successor_1
/** Encounter case 3 on the left child after remove successor (with case 1a appear after rotate)
*
* parent's left parent's left parent's left parent's left
* | | | |
* v v v v
* 10(b) 10(b) 10(b) 10(b)
* / \ successor 1 / \ / \ / \
* 4(b) 15(b) ------------> 4(b) 15(b) ------------> 7(b) 15(b) ------------> 7(b) 15(b)
* / \ / \ // \ / \ / \ / \ / \ / \
* 1(b) 7(r) 13(b) 20(b) NULL 7(r) 13(b) 20(b) 4(r) 8(b) 13(b) 20(b) 5(r) 8(b) 13(b) 20(b)
* / \ / \ // \ / \
* 5(b) 8(b) 5(b) 8(b) NULL 5(b) 4(b) 6(b)
* \ \ \
* 6(r) 6(r) 6(r)
*/
void test_removeNextLargerSuccessor_given_nodes_1_4_5_6_7_8_10_13_15_20_should_remove_successor_1(void)
{
setNode(&node6, NULL, NULL, 'r');
setNode(&node5, NULL, &node6, 'b');
setNode(&node8, NULL, NULL, 'b');
setNode(&node7, &node5, &node8, 'r');
setNode(&node13, NULL, NULL, 'b');
setNode(&node20, NULL, NULL, 'b');
setNode(&node1, NULL, NULL, 'b');
setNode(&node4, &node1, &node7, 'b');
setNode(&node15, &node13, &node20, 'b');
setNode(&node10, &node4, &node15, 'b');
Node *parent = &node10, *removeNode;
removeNode = removeNextLargerSuccessor(&parent);
TEST_ASSERT_EQUAL_PTR(&node10, parent);
TEST_ASSERT_EQUAL_PTR(&node1, removeNode);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node4);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node6);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node8);
TEST_ASSERT_EQUAL_NODE(&node4, &node6, 'r', &node5);
TEST_ASSERT_EQUAL_NODE(&node5, &node8, 'b', &node7);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node13);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node20);
TEST_ASSERT_EQUAL_NODE(&node13, &node20, 'b', &node15);
TEST_ASSERT_EQUAL_NODE(&node7, &node15, 'b', &node10);
}
开发者ID:banana93,项目名称:RedBlackTree,代码行数:43,代码来源:test_RedBlackTreeDel.c
示例4: retval
bool SelectionParser::parse(vespalib::stringref s)
{
bool retval(false);
IdSpecParser id(_bucketIdFactory);
if (id.parse(s)) {
OperatorParser op;
if (op.parse(id.getRemaining())) {
if (id.isUserSpec()) {
IntegerParser v;
if (v.parse(op.getRemaining())) {
setNode(Node::UP(new Compare(id.stealValue(), *op.getOperator(), v.stealValue(), _bucketIdFactory)));
retval = true;
}
setRemaining(v.getRemaining());
} else {
StringParser v;
if (v.parse(op.getRemaining())) {
setNode(Node::UP(new Compare(id.stealValue(), *op.getOperator(), v.stealValue(), _bucketIdFactory)));
retval = true;
}
setRemaining(v.getRemaining());
}
} else {
setRemaining(op.getRemaining());
}
} else {
setRemaining(id.getRemaining());
}
return retval;
}
开发者ID:songhtdo,项目名称:vespa,代码行数:30,代码来源:simpleparser.cpp
示例5: Storage_Demand
//存储待查找点
void Storage_Demand(T_Node Head, //链表节点
Info_Node& info,
map<short,char>& demMap, //中间节点
const string str,const string dela,const string delb){//待分割串 分割符1,分隔符2
string dema = str+delb; //扩展字符串 |
int size = dema.size(); //得到数据的大小
int sdela = dela.size(); //分割串a大小 ,
int sdelb = delb.size(); //分割串b大小 |
int pos = 0; //起始点
pos = dema.find(dela,0); //逗号分割起始位置
info.startNode = atoi(dema.substr(0,pos).c_str()); //转换成整数
setNode(Head,info.startNode,NODE_TYPE_START,NODE_TYPE); //设置节点类型
int index = pos+sdela-1;
pos = dema.find(dela,index+1);
info.endNode = atoi(dema.substr(index+1,pos).c_str());
setNode(Head,info.endNode,NODE_TYPE_END,NODE_TYPE); //设置节点类型
info.mustNumber = 0; //初始化必经点计数器
for(int i = pos+1;i<size;i++){//分割数据
pos = dema.find(delb,i);
if(pos < size){
index = atoi(dema.substr(i,pos-i).c_str());
info.mustData[info.mustNumber++] = index; //添加必经点到Info_Node
setNode(Head,index,NODE_TYPE_MID,NODE_TYPE); //设置节点类型
i = pos+sdelb-1;
}
}
}
开发者ID:lndawn,项目名称:future_net_aco,代码行数:34,代码来源:myFunc.cpp
示例6: test_getNumNodes_Vine_has_2_Nodes_should_return_2
// 1-2
void test_getNumNodes_Vine_has_2_Nodes_should_return_2(void){
setNode(&node1, NULL, &node2, 'b');
setNode(&node2, NULL, NULL, 'b');
Node *vine = &node1;
int num = getNumNodes(vine);
TEST_ASSERT_EQUAL(2,num);
}
开发者ID:Raydivine,项目名称:DSWTree,代码行数:9,代码来源:test_GetNumNodes.c
示例7: Node_Init
//初始化头节点
Topo_Node* Node_Init(const int num){
Topo_Node* Head = (Topo_Node*)malloc(sizeof(Topo_Node)*num); //创建头节点索引
for(int i = 0;i<num;i++){
(Head+i)->node = NULL; //初始化尾节点索引;
setNode(Head,i,0,NODE_NUMBER); //初始化节点个数
setNode(Head,i,NODE_TYPE_COMM,NODE_TYPE); //初始化类型为通用类型
}
return Head;
}
开发者ID:lndawn,项目名称:future_net_aco,代码行数:10,代码来源:myFunc.cpp
示例8: switchNode
BinaryTree* switchNode(int val1, int val2, BinaryTree* tree)
{
//on utilise 3 fois la fonction setNode pour faire l'échange de valeurs
int intoval2=1000;//valeur intermédiaire de remplacement d'un noeud
setNode(val1, intoval2, tree);
setNode(val2, val1, tree);
setNode(intoval2, val2, tree);
return tree;
}
开发者ID:bobjoris,项目名称:IPA,代码行数:9,代码来源:binarytree.c
示例9: test_rightVineToTree_given_Vine_has_2_node_should_do_c1
/** n = 2, m = 2^[Floor(log2 (2+1))] - 1
* = 1
*
* c1(1)
* 1(R) 2
* \ --> /
* 2 1
*/
void test_rightVineToTree_given_Vine_has_2_node_should_do_c1(void){
setNode(&node1, NULL, &node2, 'b');
setNode(&node2, NULL, NULL, 'b');
Node *vine = &node1;
rightVineToTree(&vine);
TEST_ASSERT_EQUAL_PTR(&node2, vine);
TEST_ASSERT_EQUAL_NODE(&node1, NULL, 'b', &node2);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node1);
}
开发者ID:Raydivine,项目名称:DSWTree,代码行数:18,代码来源:test_VineToTree.c
示例10: test_treeToRightVine_given_root_is_rightVine_with_2_node_should_do_nothing
/** Root-> 2
* \
* 6
*/
void test_treeToRightVine_given_root_is_rightVine_with_2_node_should_do_nothing(void){
setNode(&node2, NULL, &node6, 'b');
setNode(&node6, NULL, NULL, 'b');
Node *root = &node2;
treeToRightVine(&root);
TEST_ASSERT_EQUAL_PTR(&node2, root);
TEST_ASSERT_EQUAL_NODE(NULL, &node6, 'b', &node2);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node6);
}
开发者ID:Raydivine,项目名称:DSWTree,代码行数:14,代码来源:test_TreeToVine.c
示例11: test_delRedBlackTree_remove_2_from_tree_with_1_2_nodes
/** 2-node case
* root root
* | |
* v remove 2 v
* 1(b) ------------> 1(b)
* \
* 2(r)
*/
void test_delRedBlackTree_remove_2_from_tree_with_1_2_nodes(void)
{
setNode(&node2, NULL, NULL, 'r');
setNode(&node1, NULL, &node2, 'b');
Node *root = &node1;
delRedBlackTree(&root, &node2);
TEST_ASSERT_EQUAL_PTR(root, &node1);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node1);
}
开发者ID:banana93,项目名称:RedBlackTree,代码行数:19,代码来源:test_RedBlackTreeDel.c
示例12: test_isNodeRed_should_return_0_if_the_node_is_not_red_color
void test_isNodeRed_should_return_0_if_the_node_is_not_red_color(void){
setNode(&node5,NULL,NULL,'b');
setNode(&node30,NULL,NULL,'b');
setNode(&node20,&node5,&node30,'d');
Node *nodeA = &node5;
Node *nodeB = &node30;
Node *nodeC = &node20;
TEST_ASSERT_EQUAL(0,isNodeRed(&nodeA));
TEST_ASSERT_EQUAL(0,isNodeRed(&nodeB));
TEST_ASSERT_EQUAL(0,isNodeRed(&nodeC));
}
开发者ID:jasonchuah93,项目名称:RedBlackTree,代码行数:11,代码来源:test_RestructureNode.c
示例13: test_isNodeBlack_should_return_1_if_the_node_is_black_color
void test_isNodeBlack_should_return_1_if_the_node_is_black_color(void){
setNode(&node5,NULL,NULL,'b');
setNode(&node30,NULL,NULL,'b');
setNode(&node20,&node5,&node30,'b');
Node *nodeA = &node5;
Node *nodeB = &node30;
Node *nodeC = &node20;
TEST_ASSERT_EQUAL(1,isNodeBlack(&nodeA));
TEST_ASSERT_EQUAL(1,isNodeBlack(&nodeB));
TEST_ASSERT_EQUAL(1,isNodeBlack(&nodeC));
}
开发者ID:jasonchuah93,项目名称:RedBlackTree,代码行数:11,代码来源:test_RestructureNode.c
示例14: test_isDoubleBlack_given_a_node_with_black_color_should_return_0
void test_isDoubleBlack_given_a_node_with_black_color_should_return_0(void)
{
int result;
setNode(&node4, NULL, NULL, 'b');
setNode(&node3, NULL, NULL, 'r');
Node *root = &node4;
Node *removeNode = &node3;
result = isDoubleBlack(&root, removeNode);
TEST_ASSERT_EQUAL(0, result);
}
开发者ID:banana93,项目名称:RedBlackTree,代码行数:11,代码来源:test_RedBlackTreeDel.c
示例15: test_genericDelRedBlackTree_remove_node1_from_tree_with_node_1_2
/** 2-node case
*
* root -> 2(b) remove 1
* / ----------> 2(b) <- root
* 1(r)
*/
void test_genericDelRedBlackTree_remove_node1_from_tree_with_node_1_2(void)
{
setNode(&node1, NULL, NULL, 'r');
setNode(&node2, &node1, NULL, 'b');
Node *root = &node2, *removeNode;
removeNode = genericDelRedBlackTree(&root, &node1, compareEventInfo);
TEST_ASSERT_EQUAL_PTR(&node2, root);
TEST_ASSERT_EQUAL_PTR(&node1, removeNode);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node2);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:18,代码来源:test_GenericRedBlackTreeDel.c
示例16: test_genericAddRedBlackTree_add_node4_to_tree_with_only_node2
/** 2-node case
* add 4 2(b)
* root -> 2(b) --------> \
* 4(r)
*/
void test_genericAddRedBlackTree_add_node4_to_tree_with_only_node2(void)
{
setNode(&node4, NULL, NULL, 'r');
setNode(&node2, NULL, NULL, 'b');
Node *root = &node2;
genericAddRedBlackTree(&root, &node4, compareEventInfo);
TEST_ASSERT_EQUAL_PTR(&node2, root);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'r', &node4);
TEST_ASSERT_EQUAL_NODE(NULL, &node4, 'b', &node2);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:17,代码来源:test_GenericRedBlackTreeAdd.c
示例17: test_restructureBlackLeftWithOneRedChild_case_1b
void test_restructureBlackLeftWithOneRedChild_case_1b(void){
setNode(&node9,NULL,NULL,'r');
setNode(&node8,NULL,&node9,'b');
setNode(&node10,&node8,NULL,'b');
Node *root=&node10;
restructureBlackLeftWithOneRedChild(&root);
TEST_ASSERT_EQUAL_PTR(root,&node9);
TEST_ASSERT_EQUAL_NODE(NULL,NULL,'b',&node8);
TEST_ASSERT_EQUAL_NODE(NULL,NULL,'b',&node10);
TEST_ASSERT_EQUAL_NODE(&node8,&node10,'b',&node9);
}
开发者ID:jasonchuah93,项目名称:RedBlackTree,代码行数:12,代码来源:test_RestructureNode.c
示例18: test_restructureBlackRightWithOneRedChild_case_1a_parent_is_black
void test_restructureBlackRightWithOneRedChild_case_1a_parent_is_black(void){
setNode(&node30,NULL,NULL,'r');
setNode(&node20,NULL,&node30,'b');
setNode(&node10,NULL,&node20,'b');
Node *root=&node10;
restructureBlackRightWithOneRedChild(&root);
TEST_ASSERT_EQUAL_PTR(root,&node20);
TEST_ASSERT_EQUAL_NODE(NULL,NULL,'b',&node10);
TEST_ASSERT_EQUAL_NODE(NULL,NULL,'b',&node30);
TEST_ASSERT_EQUAL_NODE(&node10,&node30,'b',&node20);
}
开发者ID:jasonchuah93,项目名称:RedBlackTree,代码行数:12,代码来源:test_RestructureNode.c
示例19: test_genericAddRedBlackTree_add_nodeA_to_tree_with_only_nodeB
/** 2-node case
* add A B(b)
* root -> B(b) --------> /
* A(r)
*/
void test_genericAddRedBlackTree_add_nodeA_to_tree_with_only_nodeB(void)
{
setNode(&nodeA, NULL, NULL, 'r');
setNode(&nodeB, NULL, NULL, 'b');
Node *root = &nodeB;
genericAddRedBlackTree(&root, &nodeA, compareModuleAndPin);
TEST_ASSERT_EQUAL_PTR(&nodeB, root);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'r', &nodeA);
TEST_ASSERT_EQUAL_NODE(&nodeA, NULL, 'b', &nodeB);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:17,代码来源:test_GenericRedBlackTreeAdd.c
示例20: test_removeNextLargerSuccessor_remove_3_from_the_tree_with_2_3_nodes
/**
* parent parent
* | |
* v successor v
* 2(b) 2 3(b)
* \ -------------->
* 3(r)
*/
void test_removeNextLargerSuccessor_remove_3_from_the_tree_with_2_3_nodes(void)
{
setNode(&node3, NULL, NULL, 'r');
setNode(&node2, NULL, &node3, 'b');
Node *parent = &node2;
Node *removeNode;
removeNode = removeNextLargerSuccessor(&parent);
TEST_ASSERT_EQUAL_PTR(&node2, removeNode);
TEST_ASSERT_EQUAL_PTR(parent, &node3);
TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node3);
}
开发者ID:banana93,项目名称:RedBlackTree,代码行数:20,代码来源:test_RedBlackTreeDel.c
注:本文中的setNode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论