4
* $Date: 2007-01-04 18:46:10 +0100 (Thu, 04 Jan 2007) $
7
* Copyright (C) 1997-2007 The Chemistry Development Kit (CDK) project
9
* Contact: cdk-devel@lists.sourceforge.net
11
* This program is free software; you can redistribute it and/or
12
* modify it under the terms of the GNU Lesser General Public License
13
* as published by the Free Software Foundation; either version 2.1
14
* of the License, or (at your option) any later version.
15
* All we ask is that proper credit is given for our work, which includes
16
* - but is not limited to - adding the above copyright notice to the beginning
17
* of your source code files, and to any copyright notice that you may distribute
18
* with programs based on this work.
20
* This program is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
* GNU Lesser General Public License for more details.
25
* You should have received a copy of the GNU Lesser General Public License
26
* along with this program; if not, write to the Free Software
27
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
31
package org.openscience.cdk.tools;
34
* A LIFO queue for result structures. The Size is fixed so that one can use
35
* this to hold the 10 best structures, e. g.
38
*@cdk.created 2001-06-05
40
public class FixedSizeStack extends java.util.Vector implements java.io.Serializable {
42
private static final long serialVersionUID = 7820949609007415936L;
47
* Creates a fixed size stack
49
*@param size The size of this stack
51
public FixedSizeStack(int size) {
58
* Pushes an object onto the stack. If the new size then exceeds the
59
* standard size of this stack, the oldest elements in the stack are discarded.
61
*@param O The object to be pushed onto the stack
63
public void push(Object O) {
64
insertElementAt(O, 0);
72
* Returns the last object that was pushed onto the stack
74
*@return the last object that was pushed onto the stack
77
Object O = elementAt(0);