View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.cache.adt;
17  
18  /**
19   * An base implementation of {@link Listable}, supporting
20   * doubly-linked lists.
21   *
22   * @version $Id: WListableBase.java 155435 2005-02-26 13:17:27Z dirkv $
23   * @author Rodney Waldhoff
24   */
25  public class WListableBase extends ListableBase implements Listable, Cloneable {
26  
27    /** My preceeding sibling. */
28    protected transient Listable _prev = null;
29  
30    /**
31     * No arg constructor.
32     * Equivalent to {@link #WListableBase(Listable,Listable) <tt>WListableBase(null,null)</tt>}.
33     */
34    public WListableBase() {
35    }
36  
37    /**
38     * Constructor.
39     * @param prev the prev element in the list.
40     * @param next the next element in the list.
41     */
42    public WListableBase(Listable prev, Listable next) {
43      super(next);
44      _prev = prev;
45    }
46  
47    public Listable getPrev() {
48      return _prev;
49    }
50  
51    public boolean hasPrev() {
52      return (null != _prev);
53    }
54  
55    public void setPrev(Listable prev) {
56      _prev = prev;
57    }
58  }