001 /* 002 * Copyright 2001-2004 The Apache Software Foundation 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.apache.commons.cache.adt; 017 018 /** 019 * An base implementation of {@link Listable}, supporting 020 * singly-linked lists. 021 * 022 * @version $Id: ListableBase.java 155435 2005-02-26 13:17:27Z dirkv $ 023 * @author Rodney Waldhoff 024 */ 025 public class ListableBase implements Listable, Cloneable { 026 027 /** My following sibling. */ 028 protected transient Listable _next = null; 029 030 /** 031 * No arg constructor. 032 * Equivalent to {@link #ListableBase(org.apache.commons.cache.adt.Listable) <tt>ListableBase(null)</tt>}. 033 */ 034 public ListableBase() { 035 } 036 037 /** 038 * Constructor. 039 * @param next the next element in the list. 040 */ 041 public ListableBase(Listable next) { 042 _next = next; 043 } 044 045 public Listable getNext() { 046 return _next; 047 } 048 049 public boolean hasNext() { 050 return (null != _next); 051 } 052 053 public void setNext(Listable next) { 054 _next = next; 055 } 056 057 /** 058 * Throws {@link UnsupportedOperationException}. 059 */ 060 public Listable getPrev() throws UnsupportedOperationException { 061 throw new UnsupportedOperationException(); 062 } 063 064 /** 065 * Throws {@link UnsupportedOperationException}. 066 */ 067 public boolean hasPrev() throws UnsupportedOperationException { 068 throw new UnsupportedOperationException(); 069 } 070 071 /** 072 * Throws {@link UnsupportedOperationException}. 073 */ 074 public void setPrev(Listable prev) throws UnsupportedOperationException { 075 throw new UnsupportedOperationException(); 076 } 077 }