ListIterator() public method

Returns an iterator of the collection.
public ListIterator ( ) : System.Collections.IEnumerator
return System.Collections.IEnumerator
示例#1
0
        /// <summary>  Update pairing cards with the pairings</summary>
        public virtual void  finalizePairings()
        {
            System.Collections.IEnumerator walker = pairedStack.ListIterator();
            Pairing pair;

            //UPGRADE_TODO: Method 'java.util.ListIterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilListIteratorhasNext"'
            while (walker.MoveNext())
            {
                //UPGRADE_TODO: Method 'java.util.ListIterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilListIteratornext"'
                pair = (Pairing)walker.Current;
                pair.playerToPair.rounds[roundNumber].opponent = pair.opponent;
                pair.playerToPair.rounds[roundNumber].color    = pair.playerColor;
                if (pair.opponent != null)
                {
                    if (pair.playerColor == Card.WHITE)
                    {
                        pair.playerToPair.colorScore++;
                        pair.opponent.colorScore--;
                    }
                    else
                    {
                        pair.playerToPair.colorScore--;
                        pair.opponent.colorScore++;
                    }
                    pair.opponent.rounds[roundNumber].opponent = pair.playerToPair;
                    pair.opponent.rounds[roundNumber].color    = (pair.playerColor == Card.WHITE?Card.BLACK:Card.WHITE);
                }
                else
                {
                    pair.playerToPair.hadBye = true;
                }
            }
        }
示例#2
0
        /// <summary>  Adds a card to the unpaired stack data structure in score and rating sorted
        /// order
        ///
        /// </summary>
        /// <param name="card"> Card to add
        /// </param>
        public virtual void  addCardSorted(Card card)
        {
            System.Collections.IEnumerator iterator = unpairedStack.ListIterator();

            object[] obj = unpairedStack.ListSelection();

            System.Collections.ArrayList lst = new System.Collections.ArrayList();

            lst.AddRange(obj);
            Card temp;

            for (int i = 0; i < lst.Count; i++)
            {
                temp = (Card)lst[i];
                if (temp.pairingScore < card.pairingScore || (temp.pairingScore == card.pairingScore && temp.player.rating < card.player.rating))
                {
                    lst.Insert(i - 1, card);
                    //iterator.previous();
                    //iterator.add(card);
                    return;
                }
            }

            unpairedStack.Add(card);

            //UPGRADE_TODO: Method 'java.util.ListIterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilListIteratorhasNext"'
            while (iterator.MoveNext())
            {
                //UPGRADE_TODO: Method 'java.util.ListIterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1073_javautilListIteratornext"'
                temp = (Card)iterator.Current;
                if (temp.pairingScore < card.pairingScore || (temp.pairingScore == card.pairingScore && temp.player.rating < card.player.rating))
                {
                    //UPGRADE_ISSUE: Method 'java.util.ListIterator.previous' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javautilListIteratorprevious"'
                    //iterator.previous();
                    //UPGRADE_ISSUE: Method 'java.util.ListIterator.add' was not converted. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1000_javautilListIteratoradd_javalangObject"'
                    //iterator.add(card);
                    return;
                }
            }
            //we never added, so just append
            //unpairedStack.Add(card);
        }