1 |
// Jericho HTML Parser - Java based library for analysing and manipulating HTML
|
2 |
// Version 3.2
|
3 |
// Copyright (C) 2004-2009 Martin Jericho
|
4 |
// http://jericho.htmlparser.net/
|
5 |
//
|
6 |
// This library is free software; you can redistribute it and/or
|
7 |
// modify it under the terms of either one of the following licences:
|
8 |
//
|
9 |
// 1. The Eclipse Public License (EPL) version 1.0,
|
10 |
// included in this distribution in the file licence-epl-1.0.html
|
11 |
// or available at http://www.eclipse.org/legal/epl-v10.html
|
12 |
//
|
13 |
// 2. The GNU Lesser General Public License (LGPL) version 2.1 or later,
|
14 |
// included in this distribution in the file licence-lgpl-2.1.txt
|
15 |
// or available at http://www.gnu.org/licenses/lgpl.txt
|
16 |
//
|
17 |
// This library is distributed on an "AS IS" basis,
|
18 |
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
19 |
// See the individual licence texts for more details.
|
20 |
|
21 |
package net.htmlparser.jericho;
|
22 |
|
23 |
import java.util.*;
|
24 |
|
25 |
final class HTMLElementNameSet extends HashSet<String> {
|
26 |
public HTMLElementNameSet() {
|
27 |
super(1);
|
28 |
}
|
29 |
|
30 |
public HTMLElementNameSet(String... items) {
|
31 |
super(items.length*2);
|
32 |
for (int i=0; i<items.length; i++) add(items[i]);
|
33 |
}
|
34 |
|
35 |
public HTMLElementNameSet(final Collection<String> collection) {
|
36 |
super(collection.size()*2);
|
37 |
union(collection);
|
38 |
}
|
39 |
|
40 |
public HTMLElementNameSet(final String item) {
|
41 |
super(2);
|
42 |
add(item);
|
43 |
}
|
44 |
|
45 |
HTMLElementNameSet union(final String item) {
|
46 |
add(item);
|
47 |
return this;
|
48 |
}
|
49 |
|
50 |
HTMLElementNameSet union(final Collection<String> collection) {
|
51 |
for (String item : collection) add(item);
|
52 |
return this;
|
53 |
}
|
54 |
|
55 |
HTMLElementNameSet minus(final String item) {
|
56 |
remove(item);
|
57 |
return this;
|
58 |
}
|
59 |
|
60 |
HTMLElementNameSet minus(final Collection<String> collection) {
|
61 |
for (String item : collection) remove(item);
|
62 |
return this;
|
63 |
}
|
64 |
}
|