Package org.apache.activemq.kaha.impl.index

Examples of org.apache.activemq.kaha.impl.index.IndexItem


     * @see java.util.List#set(int, E)
     */
    public Object set(int index,Object element){
        load();
        Object result=null;
        IndexItem replace=indexList.isEmpty()?null:(IndexItem)indexList.get(index);
        IndexItem prev=(indexList.isEmpty()||(index-1)<0)?null:(IndexItem)indexList.get(index-1);
        IndexItem next=(indexList.isEmpty()||(index+1)>=size())?null:(IndexItem)indexList.get(index+1);
        result=getValue(replace);
        indexList.remove(index);
        delete(replace,prev,next);
        itemRemoved(index);
        add(index,element);
View Full Code Here


        add(index,element);
        return result;
    }

    protected IndexItem internalSet(int index,Object element){
        IndexItem replace=indexList.isEmpty()?null:(IndexItem)indexList.get(index);
        IndexItem prev=(indexList.isEmpty()||(index-1)<0)?null:(IndexItem)indexList.get(index-1);
        IndexItem next=(indexList.isEmpty()||(index+1)>=size())?null:(IndexItem)indexList.get(index+1);
        indexList.remove(index);
        delete(replace,prev,next);
        itemRemoved(index);
        return internalAdd(index,element);
    }
View Full Code Here

     *
     * @see java.util.List#add(int, E)
     */
    public synchronized void add(int index,Object element){
        load();
        IndexItem item=insert(index,element);
        indexList.add(index,item);
        itemAdded(item,index,element);
    }
View Full Code Here

        itemAdded(item,index,element);
    }

    protected StoreEntry internalAddLast(Object o){
        load();
        IndexItem item=writeLast(o);
        indexList.addLast(item);
        itemAdded(item,indexList.size()-1,o);
        return item;
    }
View Full Code Here

        return item;
    }

    protected StoreEntry internalAddFirst(Object o){
        load();
        IndexItem item=writeFirst(o);
        indexList.addFirst(item);
        itemAdded(item,0,o);
        return item;
    }
View Full Code Here

        return item;
    }

    protected IndexItem internalAdd(int index,Object element){
        load();
        IndexItem item=insert(index,element);
        indexList.add(index,item);
        itemAdded(item,index,element);
        return item;
    }
View Full Code Here

     * @see org.apache.activemq.kaha.ListContainer#doRemove(int)
     */
    public synchronized boolean doRemove(int index){
        load();
        boolean result=false;
        IndexItem item=indexList.get(index);
        if(item!=null){
            result=true;
            IndexItem prev=indexList.getPrevEntry(item);
            prev=prev!=null?prev:root;
            IndexItem next=indexList.getNextEntry(prev);
            indexList.remove(index);
            itemRemoved(index);
            delete(item,prev,next);
        }
        return result;
View Full Code Here

     * @see java.util.List#remove(int)
     */
    public synchronized Object remove(int index){
        load();
        Object result=null;
        IndexItem item=indexList.get(index);
        if(item!=null){
            itemRemoved(index);
            result=getValue(item);
            IndexItem prev=indexList.getPrevEntry(item);
            prev=prev!=null?prev:root;
            IndexItem next=indexList.getNextEntry(item);
            indexList.remove(index);
            delete(item,prev,next);
        }
        return result;
    }
View Full Code Here

    public synchronized int indexOf(Object o){
        load();
        int result=-1;
        if(o!=null){
            int count=0;
            IndexItem next=indexList.getFirst();
            while(next!=null){
                Object value=getValue(next);
                if(value!=null&&value.equals(o)){
                    result=count;
                    break;
View Full Code Here

    public synchronized int lastIndexOf(Object o){
        load();
        int result=-1;
        if(o!=null){
            int count=indexList.size()-1;
            IndexItem next=indexList.getLast();
            while(next!=null){
                Object value=getValue(next);
                if(value!=null&&value.equals(o)){
                    result=count;
                    break;
View Full Code Here

TOP

Related Classes of org.apache.activemq.kaha.impl.index.IndexItem

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.