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  
18  package com.gridsystems.beanfilter;
19  
20  import java.util.HashSet;
21  
22  /**
23   * Set to indicate that operations with this set must pass over all items.
24   *
25   * @author Xmas
26   * @version 1.0
27   */
28  public class AllItemsHashSet extends HashSet<Object> {
29  
30    /**
31     * Default serial UID.
32     */
33    private static final long serialVersionUID = 143647347L;
34  
35    /**
36     * Original Size.
37     */
38    int originalSize = -1;
39  
40    /**
41     * Public constructor.
42     */
43    public AllItemsHashSet() {
44      super();
45    }
46  
47    /**
48     * @param originalSize Original size.
49     */
50    public AllItemsHashSet(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  }