View Javadoc

1   /*
2   Copyright (C) 2000 - 2007 Grid Systems, S.A.
3   
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License, version 2, as
6   published by the Free Software Foundation.
7   
8   This program is distributed in the hope that it will be useful,
9   but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12  
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */
17  package com.gridsystems.beanfilter;
18  
19  import java.util.HashSet;
20  
21  /**
22   * Set to indicate that operations with this set must pass over any items.
23   *
24   * @author Xmas
25   * @version 1.0
26   */
27  public class AnyItemsHashSet extends HashSet<Object> {
28  
29    /**
30     * Default serial UID.
31     */
32    private static final long serialVersionUID = 23452345L;
33  
34  
35    /**
36     * Original Size.
37     */
38    int originalSize = -1;
39  
40    /**
41     * Public constructor.
42     */
43    public AnyItemsHashSet() {
44      super();
45    }
46  
47    /**
48     * @param originalSize Original size.
49     */
50    public AnyItemsHashSet(int originalSize) {
51      this.originalSize = originalSize;
52    }
53  
54    /**
55     * @return Returns the originalSize.
56     */
57    public int getOriginalSize() {
58      if (this.originalSize == -1) {
59        return this.size();
60      } else {
61        return originalSize;
62      }
63    }
64  
65  }