Beispiel #1
0
    public void testCase3()
    {
        //測試PripriorityQueue
        AsiaBoy[] b = new AsiaBoy[10];
        b[0] = new AsiaBoy(20);
        b[1] = new AsiaBoy(14);
        b[2] = new AsiaBoy(0);
        b[3] = new AsiaBoy(3);
        b[4] = new AsiaBoy(6);
        b[5] = new AsiaBoy(8);
        b[6] = new AsiaBoy(12);
        b[7] = new AsiaBoy(11);
        b[8] = new AsiaBoy(4);
        b[9] = new AsiaBoy(6);
        PriorityQueue <AsiaBoy> q = new PriorityQueue <AsiaBoy>();

        foreach (AsiaBoy boy in b)
        {
            q.Add(boy, boy.length);
        }

        q.popup();

        List <QueueElement <AsiaBoy> > .Enumerator it = q.getEnumerator();
        string message = "";

        while (it.MoveNext())
        {
            AsiaBoy boy = it.Current.obj;
            message += "[" + boy.length + "]";
        }

        Debug.Log("[inside PripriorityQueue] = " + message);
    }
    public void testCase3()
    {
        //測試PripriorityQueue
        AsiaBoy[] b = new AsiaBoy[10];
        b[0] = new AsiaBoy(20);
        b[1] = new AsiaBoy(14);
        b[2] = new AsiaBoy(0);
        b[3] = new AsiaBoy(3);
        b[4] = new AsiaBoy(6);
        b[5] = new AsiaBoy(8);
        b[6] = new AsiaBoy(12);
        b[7] = new AsiaBoy(11);
        b[8] = new AsiaBoy(4);
        b[9] = new AsiaBoy(6);
        PriorityQueue<AsiaBoy> q = new PriorityQueue<AsiaBoy>();

        foreach (AsiaBoy boy in b)
            q.Add(boy, boy.length);

        q.popup();

        List<QueueElement<AsiaBoy>>.Enumerator it = q.getEnumerator();
        string message="";
        while (it.MoveNext())
        {
            AsiaBoy boy = it.Current.obj;
            message += "["+boy.length+ "]";
        }

        Debug.Log("[inside PripriorityQueue] = "+message);
    }