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     * doubly-linked lists.
021     *
022     * @version $Id: WListableBase.java 155435 2005-02-26 13:17:27Z dirkv $
023     * @author Rodney Waldhoff
024     */
025    public class WListableBase extends ListableBase implements Listable, Cloneable {
026    
027      /** My preceeding sibling. */
028      protected transient Listable _prev = null;
029    
030      /**
031       * No arg constructor.
032       * Equivalent to {@link #WListableBase(Listable,Listable) <tt>WListableBase(null,null)</tt>}.
033       */
034      public WListableBase() {
035      }
036    
037      /**
038       * Constructor.
039       * @param prev the prev element in the list.
040       * @param next the next element in the list.
041       */
042      public WListableBase(Listable prev, Listable next) {
043        super(next);
044        _prev = prev;
045      }
046    
047      public Listable getPrev() {
048        return _prev;
049      }
050    
051      public boolean hasPrev() {
052        return (null != _prev);
053      }
054    
055      public void setPrev(Listable prev) {
056        _prev = prev;
057      }
058    }