KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > bak > pcj > list > DoubleDeque


1 /*
2  * Primitive Collections for Java.
3  * Copyright (C) 2003 Søren Bak
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package bak.pcj.list;
20
21 import java.util.LinkedList JavaDoc; // Workaround for bug in Javadoc 1.3.
22

23 /**
24  * This interface represents deques of double values. Deques are lists
25  * that have specialized (and efficient) methods for adding and
26  * removing elements from the beginning and end.
27  *
28  * @see java.util.LinkedList
29  * @see DoubleStack
30  *
31  * @author Søren Bak
32  * @version 1.1 2003/15/2
33  * @since 1.0
34  */

35 public interface DoubleDeque extends DoubleList {
36
37     /**
38      * Returns the first element of this deque.
39      *
40      * @return the first element of this deque.
41      *
42      * @throws IndexOutOfBoundsException
43      * if this deque is empty.
44      */

45     double getFirst();
46
47     /**
48      * Returns the last element of this deque.
49      *
50      * @return the first element of this deque.
51      *
52      * @throws IndexOutOfBoundsException
53      * if this deque is empty.
54      */

55     double getLast();
56
57     /**
58      * Removes the first element of this deque.
59      *
60      * @return the element that was removed.
61      *
62      * @throws IndexOutOfBoundsException
63      * if this deque is empty.
64      */

65     double removeFirst();
66
67     /**
68      * Removes the last element of this deque.
69      *
70      * @return the element that was removed.
71      *
72      * @throws IndexOutOfBoundsException
73      * if this deque is empty.
74      */

75     double removeLast();
76
77     /**
78      * Adds an element to the beginning of this deque.
79      *
80      * @param v
81      * the element to add to this deque.
82      */

83     void addFirst(double v);
84
85     /**
86      * Adds an element to the end of this deque.
87      *
88      * @param v
89      * the element to add to this deque.
90      */

91     void addLast(double v);
92
93 }
Popular Tags