Package org.ictclas4j.bean

Examples of org.ictclas4j.bean.QueueNode


        for (SegNode seg : colSgs) {
          preNode = seg.getRow();
          weight = seg.getWeight();

          if (preNode == 0) {
            queWork.push(new QueueNode(preNode, 0, weight));

          } else {
            if (pathWeight[preNode][0] != Utility.INFINITE_VALUE)
              queWork.push(new QueueNode(preNode, 0, weight + pathWeight[preNode][0]));
          }

        }

        // ��¼ÿһ���ڵ��N��ǰ����Ȩ��
        QueueNode minNode = null;
        int pathIndex = 0;
        while ((minNode = queWork.pop()) != null && pathIndex < pathCount) {
          pathWeight[cur][pathIndex] = minNode.getWeight();
          parent[cur].push(minNode);
          logger.debug("pathWeight[" + cur + "][" + pathIndex + "]:" + pathWeight[cur][pathIndex]);
          logger.debug("parent[" + cur + "]:" + parent[cur]);
          pathIndex++;
        }
View Full Code Here


    shortPath();
    if (vertex > 0) {

      queResult = new Queue();
      queResult.push(new QueueNode(vertex - 1, 0, 0));
      curNode = vertex - 1;
      curIndex = 0;

      while (!queResult.isEmpty()) {
        while (curNode > 0) {
          // Get its parent and store them in nParentNode,nParentIndex
          QueueNode qn = parent[curNode].pop(false);
          if (qn == null)
            qn = parent[curNode].top();
          if (qn != null) {
            curNode = qn.getParent();
            curIndex = qn.getIndex();
          }
          else
            break;
          if (curNode > 0)
            queResult.push(new QueueNode(curNode, curIndex, 0));
        }

        if (curNode == 0) {
          // ���һ���ִ�·��
          QueueNode qn = null;
          onePath = new ArrayList<Integer>();
          onePath.add(curNode);
          while ((qn = queResult.pop(false)) != null)
            onePath.add(qn.getParent());
          result.add(onePath);
          queResult.resetIndex();
          pathIndex++;// Ѱ����һ���ζ�·��
          if (pathIndex == pathCount)
            break;

          // ����ҵ�����һ��ǰ���Ľڵ㣬����������ǰ��ѹ��ջ��
          while ((qn = queResult.pop()) != null) {
            curNode = qn.getParent();
            QueueNode next = parent[curNode].pop(false);

            if (next != null) {
              curNode = next.getParent();
              next.setWeight(0);
              queResult.push(qn);
              queResult.push(next);
              break;
            }
          }
View Full Code Here

        for (SegNode seg : colSgs) {
          preNode = seg.getRow();
          weight = seg.getValue();

          if (preNode == 0) {
            queWork.push(new QueueNode(preNode, 0, weight));

          } else {
            if (pathWeight[preNode][0] != Utility.INFINITE_VALUE)
              queWork.push(new QueueNode(preNode, 0, weight + pathWeight[preNode][0]));
          }

        }

        // ��¼ÿһ���ڵ��N��ǰ����Ȩ��
        QueueNode minNode = null;
        int pathIndex = 0;
        while ((minNode = queWork.pop()) != null && pathIndex < pathCount) {
          pathWeight[cur][pathIndex] = minNode.getWeight();
          parent[cur].push(minNode);
          logger.debug("pathWeight[" + cur + "][" + pathIndex + "]:" + pathWeight[cur][pathIndex]);
          logger.debug("parent[" + cur + "]:" + parent[cur]);
          pathIndex++;
        }
View Full Code Here

    shortPath();
    if (vertex > 0) {

      queResult = new Queue();
      queResult.push(new QueueNode(vertex - 1, 0, 0));
      curNode = vertex - 1;
      curIndex = 0;

      while (!queResult.isEmpty()) {
        while (curNode > 0) {
          // Get its parent and store them in nParentNode,nParentIndex
          QueueNode qn = parent[curNode].pop(false);
          if (qn == null)
            qn = parent[curNode].top();
          if (qn != null) {
            curNode = qn.getParent();
            curIndex = qn.getIndex();
          }
          if (curNode > 0)
            queResult.push(new QueueNode(curNode, curIndex, 0));
        }

        if (curNode == 0) {
          // ���һ���ִ�·��
          QueueNode qn = null;
          onePath = new ArrayList<Integer>();
          onePath.add(curNode);
          while ((qn = queResult.pop(false)) != null)
            onePath.add(qn.getParent());
          result.add(onePath);
          queResult.resetIndex();
          pathIndex++;// Ѱ����һ���ζ�·��
          if (pathIndex == pathCount)
            break;

          // ����ҵ�����һ��ǰ���Ľڵ㣬����������ǰ��ѹ��ջ��
          while ((qn = queResult.pop()) != null) {
            curNode = qn.getParent();
            QueueNode next = parent[curNode].pop(false);

            if (next != null) {
              curNode = next.getParent();
              next.setWeight(0);
              queResult.push(qn);
              queResult.push(next);
              break;
            }
          }
View Full Code Here

TOP

Related Classes of org.ictclas4j.bean.QueueNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.