Package us.rconner.util

Examples of us.rconner.util.MutableInteger


        public void remove()
        {
            if( !canRemove ) {
                throw new IllegalStateException();
            }
            MutableInteger mutableInt = (MutableInteger) entry.getValue();
            size--;
            mutableInt.value--;
            if( mutableInt.value == 0 ) {
                iter.remove();
            }
View Full Code Here


        indices = new ArrayList();
        int size = list.size();
        for( int i = 0; i < size; i++ ) {
            if( predicate.evaluate( list.get( i ) ) ) {
                indices.add( new MutableInteger( i ) );
            }
        }
    }
View Full Code Here

    {
        if( !predicate.evaluate( object ) ) {
            throw new IllegalArgumentException( "Element " + object + " does not satisfy predicate " + predicate );
        }

        MutableInteger mutableInteger;

        // check for insertion at end
        if( index == indices.size() ) {
            mutableInteger = new MutableInteger( delegate.size() );
        } else {
            mutableInteger = new MutableInteger( (MutableInteger) indices.get( index ) );
        }

        // add to the wrapped list first, so that if it throws an
        // exception, we haven't changed the index list yet
        delegate.add( mutableInteger.value, object );
View Full Code Here

     *  Removes the object at the specified position in this
     *  <code>FilteredList</code> and returns it.
     */
    public Object remove( int index )
    {
        MutableInteger mutableInteger = (MutableInteger) indices.remove( index );
        Object object = delegate.remove( mutableInteger.value );
        modCount++;
        for( int i = index; i < indices.size(); i++ ) {
            ((MutableInteger) indices.get( i )).value--;
        }
View Full Code Here

    }


    public int getCount( Object object )
    {
        MutableInteger mutableInt = (MutableInteger) delegate.get( object );
        return (mutableInt == null) ? 0 : mutableInt.value;
    }
View Full Code Here

    }


    public boolean add( Object object, int count )
    {
        MutableInteger mutableInt = (MutableInteger) delegate.get( object );
        if( mutableInt == null ) {
            delegate.put( object, new MutableInteger( count ) );
        } else {
            mutableInt.value += count;
        }
        size += count;
        return true;
View Full Code Here

    }


    public boolean remove( Object object, int count )
    {
        MutableInteger mutableInt = (MutableInteger) delegate.get( object );
        if( mutableInt == null ) {
            return false;
        }
        size -= count;
        mutableInt.value -= count;
View Full Code Here

    }


    protected boolean removeElement( Object object )
    {
        MutableInteger mutableInt = (MutableInteger) delegate.remove( object );
        if( mutableInt == null ) {
            return false;
        }
        size -= mutableInt.value;
        return true;
View Full Code Here

        public void remove()
        {
            if( entry == null ) {
                throw new IllegalStateException();
            }
            MutableInteger mutableInt = (MutableInteger) entry.getValue();
            size -= mutableInt.value;
            i.remove();
        }
View Full Code Here

TOP

Related Classes of us.rconner.util.MutableInteger

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.