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

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


    public Object[] toArray(Object[] result){
        IndexLinkedList list=container.getItemList();
        synchronized(list){
            if(result.length<=list.size()){
                IndexItem item = list.getFirst();
                int count = 0;
                while (item != null){
                    Object value=container.getValue(item)
                    result[count++] = value;
                   
View Full Code Here


                loaded=true;
                try{
                    init();
                    long nextItem=root.getNextItem();
                    while(nextItem!=Item.POSITION_NOT_SET){
                        IndexItem item=indexManager.getIndex(nextItem);
                        indexList.add(item);
                        itemAdded(item,indexList.size()-1,getValue(item));
                        nextItem=item.getNextItem();
                    }
                }catch(IOException e){
                    log.error("Failed to load container "+getId(),e);
                    throw new RuntimeStoreException(e);
                }
View Full Code Here

     * @see org.apache.activemq.kaha.ListContainer#removeFirst()
     */
    public synchronized Object removeFirst(){
        load();
        Object result=null;
        IndexItem item=(IndexItem)indexList.getFirst();
        if(item!=null){
            itemRemoved(0);
            result=getValue(item);
            IndexItem prev=root;
            IndexItem next=indexList.size()>1?(IndexItem)indexList.get(1):null;
            indexList.removeFirst();
            delete(item,prev,next);
            item=null;
        }
        return result;
View Full Code Here

     * @see org.apache.activemq.kaha.ListContainer#removeLast()
     */
    public synchronized Object removeLast(){
        load();
        Object result=null;
        IndexItem last=indexList.getLast();
        if(last!=null){
            itemRemoved(indexList.size()-1);
            result=getValue(last);
            IndexItem prev=indexList.getPrevEntry(last);
            IndexItem next=null;
            indexList.removeLast();
            delete(last,prev,next);
        }
        return result;
    }
View Full Code Here

     */
    public synchronized boolean contains(Object o){
        load();
        boolean result=false;
        if(o!=null){
            IndexItem next=indexList.getFirst();
            while(next!=null){
                Object value=getValue(next);
                if(value!=null&&value.equals(o)){
                    result=true;
                    break;
View Full Code Here

     * @see java.util.List#toArray()
     */
    public synchronized Object[] toArray(){
        load();
        List tmp=new ArrayList(indexList.size());
        IndexItem next=indexList.getFirst();
        while(next!=null){
            Object value=getValue(next);
            tmp.add(value);
            next=indexList.getNextEntry(next);
        }
View Full Code Here

     * @see java.util.List#toArray(T[])
     */
    public synchronized Object[] toArray(Object[] a){
        load();
        List tmp=new ArrayList(indexList.size());
        IndexItem next=indexList.getFirst();
        while(next!=null){
            Object value=getValue(next);
            tmp.add(value);
            next=indexList.getNextEntry(next);
        }
View Full Code Here

     */
    public synchronized boolean remove(Object o){
        load();
        boolean result=false;
        int pos=0;
        IndexItem next=indexList.getFirst();
        while(next!=null){
            Object value=getValue(next);
            if(value!=null&&value.equals(o)){
                remove(next);
                itemRemoved(pos);
View Full Code Here

        }
        return result;
    }

    protected void remove(IndexItem item){
        IndexItem prev=indexList.getPrevEntry(item);
        IndexItem next=indexList.getNextEntry(item);
        indexList.remove(item);
        delete(item,prev,next);
    }
View Full Code Here

     * @see java.util.List#retainAll(java.util.Collection)
     */
    public synchronized boolean retainAll(Collection c){
        load();
        List tmpList=new ArrayList();
        IndexItem next=indexList.getFirst();
        while(next!=null){
            Object o=getValue(next);
            if(!c.contains(o)){
                tmpList.add(o);
            }
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.