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

📄 digraphdiagnose.h

📁 这是一个从音频信号里提取特征参量的程序
💻 H
📖 第 1 页 / 共 5 页
字号:
    //    graph_00->insertArc(graph_00->getStart(), VA, true);        graph_00->insertArc(VA, VA, false, 0.3);    graph_00->insertArc(VA, VR, false, 0.3);    graph_00->insertArc(VA, VB, true);    graph_00->insertArc(VA, VC, true);      graph_00->insertArc(VB, VL, false, 0.2);    graph_00->insertArc(VC, VK, false, 3.6);    graph_00->insertArc(VM, VK, false, 0.6);    graph_00->insertArc(VM, VA, false, 1.2);    graph_00->insertArc(VL, VR, false, -0.7);    graph_00->insertArc(VL, VC, false, 0.4);    graph_00->insertArc(VS, VK, false, -0.2);    graph_00->insertArc(VS, VS, false, -0.6);    graph_00->insertArc(VR, graph_00->getTerm(), true);          // create the graph    //    DiGraph<Char>* graph_01 = new DiGraph<Char>(*graph_00);        // create the graph    //    DiGraph<Char>* graph_02 = new DiGraph<Char>(USER);        VA = graph_02->insertVertex(A);    VB = graph_02->insertVertex(B);    VC = graph_02->insertVertex(C);        VK = graph_02->insertVertex(K);    VL = graph_02->insertVertex(L);    VM = graph_02->insertVertex(M);        VS = graph_02->insertVertex(S);    VR = graph_02->insertVertex(R);        // connect the graph    //    graph_02->insertArc(graph_02->getStart(), VA, true);      graph_02->insertArc(VA, VA, false, 0.3);    graph_02->insertArc(VA, VR, false, 0.3);    graph_02->insertArc(VA, VB, true);    graph_02->insertArc(VA, VC, true);      graph_02->insertArc(VB, VL, false, 0.2);    graph_02->insertArc(VC, VK, false, 3.6);    graph_02->insertArc(VM, VK, false, 0.6);    graph_02->insertArc(VM, VA, false, -1.2);    graph_02->insertArc(VL, VR, false, -0.7);    graph_02->insertArc(VL, VC, false, 0.4);    graph_02->insertArc(VS, VK, false, -0.2);    graph_02->insertArc(VS, VS, false, -0.6);    graph_02->insertArc(VR, graph_02->getTerm(), true);            // graph_00 and graph_01 should be equal    //    if (!graph_00->eq(*graph_01)) {      return Error::handle(name(), L"eq", Error::TEST, __FILE__, __LINE__);    }        // graph_00 and graph_01 should not be equal    //    if (graph_00->eq(*graph_02)) {      return Error::handle(name(), L"eq", Error::TEST, __FILE__, __LINE__);    }          // clean up memory    //    graph_00->clear(Integral::FREE);    graph_01->clear();    graph_02->clear();    delete graph_00;    delete graph_01;    delete graph_02;      }    // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }  // --------------------------------------------------------------------  //  // 2. class-specific public methods:  //     graph manipulation methods  //  // --------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put(L"testing class-specific public methods: graph manipulation methods...\n");    Console::increaseIndention();   }  // test insert vetrex methods in SYSTEM-allocation mode  //  DiGraph<Char>* graph_03 = new DiGraph<Char>();  // create some vertices  //  A = new Char('A');  B = new Char('B');  C = new Char('C');  K = new Char('K');    VA = graph_03->insertVertex(A);  VB = graph_03->insertVertex(B);  VC = graph_03->insertVertex(C);  VK = graph_03->insertVertex(K);      L = new Char('L');      VL = new GraphVertex<TObject>();      // the graph should contain VA, VB, VC and VK  //  if ((!graph_03->contains(VA)) || (!graph_03->contains(VB)) ||      (!graph_03->contains(VC)) || (!graph_03->contains(VK))) {    return Error::handle(name(), L"insertVertex", Error::TEST,			 __FILE__, __LINE__);  }  // the graph should not contain VL  //  if (graph_03->contains(VL)) {    return Error::handle(name(), L"insertVertex", Error::TEST,			 __FILE__, __LINE__);  }    // test the find and contains methods in SYSTEM-allocation mode  //  graph_03->setMark();  if (!graph_03->contains(VC)) {    return Error::handle(name(), L"contains", Error::TEST, __FILE__, __LINE__);  }  if (graph_03->contains(VL)) {    return Error::handle(name(), L"contains", Error::TEST, __FILE__, __LINE__);  }  if (!graph_03->contains(K)) {    return Error::handle(name(), L"contains", Error::TEST, __FILE__, __LINE__);  }    if (graph_03->contains(L)) {    return Error::handle(name(), L"contains", Error::TEST, __FILE__, __LINE__);  }    if (!graph_03->find(VA)) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }  if (graph_03->getCurr() != VA) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }  if (!graph_03->find(K)) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }  if (graph_03->getCurr() != VK) {    return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);  }    graph_03->gotoMark();    // test remove vetrex methods in SYSTEM-allocation mode  //  graph_03->find(VC);  graph_03->removeVertex();  if (graph_03->contains(VC)) {    return Error::handle(name(), L"remove", Error::TEST, __FILE__, __LINE__);  }  TObject* item = new TObject();  graph_03->find(VK);  graph_03->removeVertex(item);  if ((graph_03->contains(VK)) || (!item->eq(*K))) {    return Error::handle(name(), L"remove", Error::TEST, __FILE__, __LINE__);  }           // test insert arc methods in SYSTEM-allocation mode  //  graph_03->insertArc(graph_03->getStart(), VB, true);    graph_03->insertArc(VB, graph_03->getTerm(), false, 0.3);  // the start vertex should have an epsilon transition to VB  //  GraphArc<TObject>* my_arc = graph_03->getStart()->getFirst();      if ((my_arc->getVertex()) != VB && (!my_arc->getEpsilon())) {    return Error::handle(name(), L"insertArc", Error::TEST,			 __FILE__, __LINE__);  }   boolean more_nodes = graph_03->gotoFirst();  while (more_nodes) {        // VB should a weighted arc to the term vertex    //    GraphVertex<TObject>* my_vertex =      (GraphVertex<TObject>*)graph_03->getCurr();        GraphArc<TObject>* my_arc = my_vertex->getFirst();    if (my_vertex == VB) {      if ((my_arc->getVertex() != graph_03->getTerm()) &&	  (!Integral::almostEqual((double)my_arc->getWeight(), 0.3))) {	return Error::handle(name(), L"insertArc", Error::TEST,			     __FILE__, __LINE__);      }    }        more_nodes = graph_03->gotoNext();  }  // test remove arc methods in SYSTEM-allocation mode  //  graph_03->removeArc(VB, graph_03->getTerm());  more_nodes = graph_03->gotoFirst();  while (more_nodes) {        // VB should a weighted arc to the term vertex    //    GraphVertex<TObject>* my_vertex =      (GraphVertex<TObject>*)graph_03->getCurr();        GraphArc<TObject>* my_arc = my_vertex->getFirst();    if (my_vertex == VB) {      if (my_arc != (GraphArc<TObject>*)NULL) {	return Error::handle(name(), L"removeArc", Error::TEST,			     __FILE__, __LINE__);      }    }        more_nodes = graph_03->gotoNext();  }    // clean up memory  //  delete item;  delete L;  delete VL;  graph_03->clear(Integral::FREE);  delete A;  delete B;  delete C;  delete K;  delete graph_03;  {    // test insert vetrex methods in USER-allocation mode    //    DiGraph<Char>* graph_03 = new DiGraph<Char>(USER);        // create some vertices    //    A = new Char('A');    B = new Char('B');    C = new Char('C');    K = new Char('K');          VA = graph_03->insertVertex(A);    VB = graph_03->insertVertex(B);    VC = graph_03->insertVertex(C);    VK = graph_03->insertVertex(K);            L = new Char('L');        VL = new GraphVertex<TObject>();    // the graph should contain VA, VB, VC and VK    //    if ((!graph_03->contains(VA)) || (!graph_03->contains(VB)) ||	(!graph_03->contains(VC)) || (!graph_03->contains(VK))) {      return Error::handle(name(), L"insertVertex", Error::TEST,			   __FILE__, __LINE__);    }        // the graph should not contain VL    //    if (graph_03->contains(VL)) {      return Error::handle(name(), L"insertVertex", Error::TEST,			   __FILE__, __LINE__);    }      // test the find and contains methods in USER-allocation mode    //    graph_03->setMark();    if (!graph_03->contains(VC)) {      return Error::handle(name(), L"contains", Error::TEST,			   __FILE__, __LINE__);    }    if (graph_03->contains(VL)) {      return Error::handle(name(), L"contains", Error::TEST,			   __FILE__, __LINE__);    }    if (!graph_03->contains(K)) {      return Error::handle(name(), L"contains", Error::TEST,			   __FILE__, __LINE__);    }      if (graph_03->contains(L)) {      return Error::handle(name(), L"contains", Error::TEST,			   __FILE__, __LINE__);    }      if (!graph_03->find(VA)) {      return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);    }    if (graph_03->getCurr() != VA) {      return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);    }    if (!graph_03->find(K)) {      return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);    }    if (graph_03->getCurr() != VK) {      return Error::handle(name(), L"find", Error::TEST, __FILE__, __LINE__);    }      graph_03->gotoMark();        // test remove vetrex methods in USER-allocation mode    //    graph_03->find(VC);    graph_03->removeVertex(item);    if ((graph_03->contains(VC)) || (!item->eq(*C))) {          return Error::handle(name(), L"remove", Error::TEST, __FILE__, __LINE__);    }    delete C;        TObject* item = (TObject*)NULL;    graph_03->find(VK);    graph_03->removeVertex(item);    if ((graph_03->contains(VK)) || (!item->eq(*K))) {      return Error::handle(name(), L"remove", Error::TEST, __FILE__, __LINE__);    }      delete K;    // test insert arc methods in USER-allocation mode    //    graph_03->insertArc(graph_03->getStart(), VB, true);      graph_03->insertArc(VB, graph_03->getTerm(), false, 0.3);        // the start vertex should have an epsilon transition to VB    //    GraphArc<TObject>* my_arc = graph_03->getStart()->getFirst();        if ((my_arc->getVertex() != VB) && (!my_arc->getEpsilon())) {      return Error::handle(name(), L"insertArc", Error::TEST,			   __FILE__, __LINE__);    }        boolean more_nodes = graph_03->gotoFirst();        while (more_nodes) {            // VB should a weighted arc to the term vertex      //      GraphVertex<TObject>* my_vertex =	(GraphVertex<TObject>*)graph_03->getCurr();            GraphArc<TObject>* my_arc = my_vertex->getFirst();            if (my_vertex == VB) {	if ((my_arc->getVertex() != graph_03->getTerm()) &&	    (!Integral::almostEqual((double)my_arc->getWeight(), 0.3))) {	  return Error::handle(name(), L"insertArc", Error::TEST,			       __FILE__, __LINE__);	}      }            more_nodes = graph_03->gotoNext();    }        // test remove arc methods in USER-allocation mode    //    graph_03->removeArc(VB, graph_03->getTerm());        more_nodes = graph_03->gotoFirst();        while (more_nodes) {            // VB should a weighted arc to the term vertex      //      GraphVertex<TObject>* my_vertex =	(GraphVertex<TObject>*)graph_03->getCurr();            GraphArc<TObject>* my_arc = my_vertex->getFirst();            if (my_vertex == VB) {	if (my_arc != (GraphArc<TObject>*)NULL) {	  return Error::handle(name(), L"removeArc", Error::TEST,			       __FILE__, __LINE__);	}      }            more_nodes = graph_03->gotoNext();    }    // clean up memory (note K and C have already been deleted from the graph)    //    graph_03->clear(Integral::FREE);    delete L;      delete VL;        delete graph_03;  }  // reset indentation  //  if (level_a > Integral::NONE) {    Console::decreaseIndention();  }    // --------------------------------------------------------------------  //  // 3. class-specific public methods:  //     graph property methods  //  // --------------------------------------------------------------------  // set indentation  //  if (level_a > Integral::NONE) {    Console::put(L"testing class-specific public methods: graph property methods...\n");    Console::increaseIndention();   }  // test the graph get method in SYSTEM-allocation mode  //    {    // -------------------------------------------------    // START -(epi) -> a    // a     -(0.1) -> a    // a     -(0.5) -> b    // b     -(0.7) -> b    // b     -(epi) -> TERM     // -------------------------------------------------        // create the graph items    //        Char* a = new Char('a');    Char* b = new Char('b');    TopoTriple* triple;      // create the list of arcs    //    SingleLinkedList<TopoTriple> arcs;        Float float_00(0.0);    Boolean bool_00(true);    Pair<Long, Long> pair_00(DiGraph<Char>::START_INDEX, 0);    triple = new TopoTriple(pair_00, float_00, bool_00);    arcs.insert(triple);    delete triple;        Float float_01(0.1);    Boolean bool_01(false);    Pair<Long, Long> pair_01(0, 0);    triple = new TopoTriple(pair_01, float_01, bool_01);    arcs.insert(triple);    delete triple;        Float float_02(0.5);    Boolean bool_02(false);    Pair<Long, Long> pair_02(0, 1);

⌨️ 快捷键说明

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