protected List<BubbleGlyph> getAndExpireBubbles (Name speaker)
    {
        int num = _bubbles.size();

        // first, get all the old bubbles belonging to the user
        List<BubbleGlyph> oldbubs = Lists.newArrayList();
        if (speaker != null) {
            for (int ii=0; ii < num; ii++) {
                BubbleGlyph bub = _bubbles.get(ii);
                if (bub.isSpeaker(speaker)) {
                    oldbubs.add(bub);
                }
            }
        }

        // see if we need to expire this user's oldest bubble
        if (oldbubs.size() >= MAX_BUBBLES_PER_USER) {
            BubbleGlyph bub = oldbubs.remove(0);
            _bubbles.remove(bub);
            _target.abortAnimation(bub);

            // or some other old bubble
        } else if (num >= MAX_BUBBLES) {
            _target.abortAnimation(_bubbles.remove(0));
        }

        // return the speaker's old bubbles
        return oldbubs;
    }
protected List < BubbleGlyph > getAndExpireBubbles ( Name speaker ) { int num = _bubbles . size ( ) ; List < BubbleGlyph > oldbubs = Lists . newArrayList ( ) ; if ( speaker != null ) { for ( int ii = 0 ; ii < num ; ii ++ ) { BubbleGlyph bub = _bubbles . get ( ii ) ; if ( bub . isSpeaker ( speaker ) ) { oldbubs . add ( bub ) ; } } } if ( oldbubs . size ( ) >= MAX_BUBBLES_PER_USER ) { BubbleGlyph bub = oldbubs . remove ( 0 ) ; _bubbles . remove ( bub ) ; _target . abortAnimation ( bub ) ; } else if ( num >= MAX_BUBBLES ) { _target . abortAnimation ( _bubbles . remove ( 0 ) ) ; } return oldbubs ; }
Expire a bubble, if necessary, and return the old bubbles for the specified speaker.