org.apache.activemq.kaha.impl.index
Interface IndexLinkedList

All Known Implementing Classes:
DiskIndexLinkedList, VMIndexLinkedList

public interface IndexLinkedList

Inteface to LinkedList of Indexes


Method Summary
 boolean add(IndexItem item)
          Appends the specified element to the end of this list.
 void add(int index, IndexItem element)
          Inserts the specified element at the specified position in this list.
 void addFirst(IndexItem item)
          Inserts the given element at the beginning of this list.
 void addLast(IndexItem item)
          Appends the given element to the end of this list.
 void clear()
          Removes all of the elements from this list.
 IndexItem get(int index)
          Returns the element at the specified position in this list.
 StoreEntry getEntry(StoreEntry entry)
          Ensure we have the up to date entry
 IndexItem getFirst()
          Returns the first element in this list.
 IndexItem getLast()
          Returns the last element in this list.
 IndexItem getNextEntry(IndexItem entry)
          Retrieve the next entry after this entry
 IndexItem getPrevEntry(IndexItem entry)
          Retrive the prev entry after this entry
 IndexItem getRoot()
           
 int indexOf(StoreEntry o)
          Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not contain this element.
 boolean isEmpty()
          is the list empty?
 StoreEntry refreshEntry(StoreEntry current)
          Update the indexes of a StoreEntry
 void remove(IndexItem e)
          remove an entry
 Object remove(int index)
          Removes the element at the specified position in this list.
 StoreEntry removeFirst()
          Removes and returns the first element from this list.
 Object removeLast()
          Removes and returns the last element from this list.
 void setRoot(IndexItem newRoot)
          Set the new Root
 int size()
          Returns the number of elements in this list.
 

Method Detail

setRoot

void setRoot(IndexItem newRoot)
Set the new Root

Parameters:
newRoot -

getRoot

IndexItem getRoot()
Returns:
the root used by the List

getFirst

IndexItem getFirst()
Returns the first element in this list.

Returns:
the first element in this list.

getLast

IndexItem getLast()
Returns the last element in this list.

Returns:
the last element in this list.

removeFirst

StoreEntry removeFirst()
Removes and returns the first element from this list.

Returns:
the first element from this list.

removeLast

Object removeLast()
Removes and returns the last element from this list.

Returns:
the last element from this list.

addFirst

void addFirst(IndexItem item)
Inserts the given element at the beginning of this list.

Parameters:
item -

addLast

void addLast(IndexItem item)
Appends the given element to the end of this list. (Identical in function to the add method; included only for consistency.)

Parameters:
item -

size

int size()
Returns the number of elements in this list.

Returns:
the number of elements in this list.

isEmpty

boolean isEmpty()
is the list empty?

Returns:
true if there are no elements in the list

add

boolean add(IndexItem item)
Appends the specified element to the end of this list.

Parameters:
item -
Returns:
true (as per the general contract of Collection.add).

clear

void clear()
Removes all of the elements from this list.


get

IndexItem get(int index)
Returns the element at the specified position in this list.

Parameters:
index - index of element to return.
Returns:
the element at the specified position in this list.
Throws:
IndexOutOfBoundsException - if the specified index is is out of range (index < 0 || index >= size()).

add

void add(int index,
         IndexItem element)
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).

Parameters:
index - index at which the specified element is to be inserted.
element - element to be inserted.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index > size()).

remove

Object remove(int index)
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.

Parameters:
index - the index of the element to removed.
Returns:
the element previously at the specified position.
Throws:
IndexOutOfBoundsException - if the specified index is out of range (index < 0 || index >= size()).

indexOf

int indexOf(StoreEntry o)
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 (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.

Parameters:
o - element to search for.
Returns:
the index in this list of the first occurrence of the specified element, or -1 if the list does not contain this element.

getNextEntry

IndexItem getNextEntry(IndexItem entry)
Retrieve the next entry after this entry

Parameters:
entry -
Returns:
next entry

getPrevEntry

IndexItem getPrevEntry(IndexItem entry)
Retrive the prev entry after this entry

Parameters:
entry -
Returns:
prev entry

remove

void remove(IndexItem e)
remove an entry

Parameters:
e -

getEntry

StoreEntry getEntry(StoreEntry entry)
Ensure we have the up to date entry

Parameters:
entry -
Returns:
the entry

refreshEntry

StoreEntry refreshEntry(StoreEntry current)
Update the indexes of a StoreEntry

Parameters:
current -
Returns:
update StoreEntry


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.