org.apache.commons.cache.adt
Class ListableBase

java.lang.Object
  extended by org.apache.commons.cache.adt.ListableBase
All Implemented Interfaces:
Cloneable, Listable
Direct Known Subclasses:
ListableObject, WListableBase

public class ListableBase
extends Object
implements Listable, Cloneable

An base implementation of Listable, supporting singly-linked lists.

Version:
$Id: ListableBase.java 155435 2005-02-26 13:17:27Z dirkv $
Author:
Rodney Waldhoff

Field Summary
protected  Listable _next
          My following sibling.
 
Constructor Summary
ListableBase()
          No arg constructor.
ListableBase(Listable next)
          Constructor.
 
Method Summary
 Listable getNext()
          Return the Listable element following me, or null if I am the last element in the list.
 Listable getPrev()
          Throws UnsupportedOperationException.
 boolean hasNext()
          Return true if there is a Listable element following me, false otherwise.
 boolean hasPrev()
          Throws UnsupportedOperationException.
 void setNext(Listable next)
          Change my next element to next.
 void setPrev(Listable prev)
          Throws UnsupportedOperationException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_next

protected transient Listable _next
My following sibling.

Constructor Detail

ListableBase

public ListableBase()
No arg constructor. Equivalent to ListableBase(null).


ListableBase

public ListableBase(Listable next)
Constructor.

Parameters:
next - the next element in the list.
Method Detail

getNext

public Listable getNext()
Description copied from interface: Listable
Return the Listable element following me, or null if I am the last element in the list.

Specified by:
getNext in interface Listable
Returns:
the Listable element following me, or null.

hasNext

public boolean hasNext()
Description copied from interface: Listable
Return true if there is a Listable element following me, false otherwise.

Specified by:
hasNext in interface Listable
Returns:
true if there is a Listable element following me, false otherwise.

setNext

public void setNext(Listable next)
Description copied from interface: Listable
Change my next element to next. Note that this does not change the Listable.getPrev() value of next.

Specified by:
setNext in interface Listable
Parameters:
next - my new following sibling.

getPrev

public Listable getPrev()
                 throws UnsupportedOperationException
Throws UnsupportedOperationException.

Specified by:
getPrev in interface Listable
Returns:
the Listable element preceeding me, or null.
Throws:
UnsupportedOperationException - if I am a singly-linked list.

hasPrev

public boolean hasPrev()
                throws UnsupportedOperationException
Throws UnsupportedOperationException.

Specified by:
hasPrev in interface Listable
Returns:
true if there is a Listable element preceeding me, false otherwise.
Throws:
UnsupportedOperationException - if I am a singly-linked list.

setPrev

public void setPrev(Listable prev)
             throws UnsupportedOperationException
Throws UnsupportedOperationException.

Specified by:
setPrev in interface Listable
Parameters:
prev - my new preceeding sibling.
Throws:
UnsupportedOperationException - if I am a singly-linked or read-only list.


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.