You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2006/07/20 22:11:22 UTC

svn commit: r424040 - /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexLinkedList.java

Author: rajdavies
Date: Thu Jul 20 13:11:22 2006
New Revision: 424040

URL: http://svn.apache.org/viewvc?rev=424040&view=rev
Log:
Interface for IndexLinkedList

Added:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexLinkedList.java   (with props)

Added: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexLinkedList.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexLinkedList.java?rev=424040&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexLinkedList.java (added)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexLinkedList.java Thu Jul 20 13:11:22 2006
@@ -0,0 +1,154 @@
+package org.apache.activemq.kaha.impl;
+
+interface IndexLinkedList{
+    
+    /**
+     * @return the root used by the List
+     */
+    public IndexItem getRoot();
+    
+    /**
+     * Returns the first element in this list.
+     * 
+     * @return the first element in this list.
+     */
+    public IndexItem getFirst();
+
+    /**
+     * Returns the last element in this list.
+     * 
+     * @return the last element in this list.
+     */
+    public IndexItem getLast();
+
+    /**
+     * Removes and returns the first element from this list.
+     * 
+     * @return the first element from this list.
+     */
+    public IndexItem removeFirst();
+
+    /**
+     * Removes and returns the last element from this list.
+     * 
+     * @return the last element from this list.
+     */
+    public Object removeLast();
+
+    /**
+     * Inserts the given element at the beginning of this list.
+     * 
+     * @param o the element to be inserted at the beginning of this list.
+     */
+    public void addFirst(IndexItem item);
+
+    /**
+     * Appends the given element to the end of this list. (Identical in function to the <tt>add</tt> method; included
+     * only for consistency.)
+     * 
+     * @param o the element to be inserted at the end of this list.
+     */
+    public void addLast(IndexItem item);
+
+    /**
+     * Returns the number of elements in this list.
+     * 
+     * @return the number of elements in this list.
+     */
+    public int size();
+
+    /**
+     * is the list empty?
+     * 
+     * @return true if there are no elements in the list
+     */
+    public boolean isEmpty();
+
+    /**
+     * Appends the specified element to the end of this list.
+     * 
+     * @param o element to be appended to this list.
+     * @return <tt>true</tt> (as per the general contract of <tt>Collection.add</tt>).
+     */
+    public boolean add(IndexItem item);
+
+    /**
+     * Removes all of the elements from this list.
+     */
+    public void clear();
+
+    // Positional Access Operations
+    /**
+     * Returns the element at the specified position in this list.
+     * 
+     * @param index index of element to return.
+     * @return the element at the specified position in this list.
+     * 
+     * @throws IndexOutOfBoundsException if the specified index is is out of range (<tt>index &lt; 0 || index &gt;= size()</tt>).
+     */
+    public IndexItem get(int index);
+
+    /**
+     * Inserts the specified element at the specified position in this list. Shifts the element currently at that
+     * position (if any) and any subsequent elements to the right (adds one to their indices).
+     * 
+     * @param index index at which the specified element is to be inserted.
+     * @param element element to be inserted.
+     * 
+     * @throws IndexOutOfBoundsException if the specified index is out of range (<tt>index &lt; 0 || index &gt; size()</tt>).
+     */
+    public void add(int index,IndexItem element);
+
+    /**
+     * Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts
+     * one from their indices). Returns the element that was removed from the list.
+     * 
+     * @param index the index of the element to removed.
+     * @return the element previously at the specified position.
+     * 
+     * @throws IndexOutOfBoundsException if the specified index is out of range (<tt>index &lt; 0 || index &gt;= size()</tt>).
+     */
+    public Object remove(int index);
+
+    // Search Operations
+    /**
+     * Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not
+     * contain this element. More formally, returns the lowest index i such that
+     * <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>, or -1 if there is no such index.
+     * 
+     * @param o element to search for.
+     * @return the index in this list of the first occurrence of the specified element, or -1 if the list does not
+     *         contain this element.
+     */
+    public int indexOf(IndexItem o);
+
+    /**
+     * Retrieve the next entry after this entry
+     * 
+     * @param entry
+     * @return next entry
+     */
+    public IndexItem getNextEntry(IndexItem entry);
+
+    /**
+     * Retrive the prev entry after this entry
+     * 
+     * @param entry
+     * @return prev entry
+     */
+    public IndexItem getPrevEntry(IndexItem entry);
+
+    
+    /**
+     * remove an entry
+     * @param e
+     */
+    public void remove(IndexItem e);
+    
+    /**
+     * Ensure we have the up to date entry
+     * @param current
+     * @return the entry
+     */
+    public  IndexItem getEntry(IndexItem current);
+}
\ No newline at end of file

Propchange: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexLinkedList.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/IndexLinkedList.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain