Line 1... |
Line 1... |
1 |
/*
|
1 |
/*
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3 |
*
|
3 |
*
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
5 |
*
|
5 |
*
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
7 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
8 |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
|
9 |
* language governing permissions and limitations under the License.
|
9 |
* language governing permissions and limitations under the License.
|
Line 48... |
Line 48... |
48 |
return (IncludeExclude<T>) FULL;
|
48 |
return (IncludeExclude<T>) FULL;
|
49 |
}
|
49 |
}
|
50 |
|
50 |
|
51 |
@SafeVarargs
|
51 |
@SafeVarargs
|
52 |
public static <T> IncludeExclude<T> getNormalized(final T... includes) {
|
52 |
public static <T> IncludeExclude<T> getNormalized(final T... includes) {
|
53 |
return getNormalized(Arrays.asList(includes));
|
53 |
return getNormalizedInclude(Arrays.asList(includes));
|
54 |
}
|
54 |
}
|
55 |
|
55 |
|
- |
|
56 |
@Deprecated
|
56 |
public static <T> IncludeExclude<T> getNormalized(final Collection<? extends T> includes) {
|
57 |
public static <T> IncludeExclude<T> getNormalized(final Collection<? extends T> includes) {
|
- |
|
58 |
return getNormalizedInclude(includes);
|
- |
|
59 |
}
|
- |
|
60 |
|
- |
|
61 |
/**
|
- |
|
62 |
* Return the normalized version including only the passed values. E.g. if <code>includes</code>
|
- |
|
63 |
* is empty or <code>null</code>, this won't allocate any memory and {@link #getEmpty()} or
|
- |
|
64 |
* {@link #getFull()} will be returned.
|
- |
|
65 |
*
|
- |
|
66 |
* @param <T> type of items
|
- |
|
67 |
* @param includes which values to include.
|
- |
|
68 |
* @return the normalized version.
|
- |
|
69 |
*/
|
- |
|
70 |
public static <T> IncludeExclude<T> getNormalizedInclude(final Collection<? extends T> includes) {
|
57 |
return getNormalized(includes, Collections.<T> emptySet());
|
71 |
return getNormalized(includes, Collections.<T> emptySet());
|
58 |
}
|
72 |
}
|
59 |
|
73 |
|
- |
|
74 |
/**
|
- |
|
75 |
* Return the normalized version excluding only the passed values. E.g. if <code>excludes</code>
|
- |
|
76 |
* is empty or <code>null</code>, this won't allocate any memory and {@link #getFull()} or
|
- |
|
77 |
* {@link #getEmpty()} will be returned.
|
- |
|
78 |
*
|
- |
|
79 |
* @param <T> type of items
|
- |
|
80 |
* @param excludes which values to exclude.
|
- |
|
81 |
* @return the normalized version.
|
- |
|
82 |
*/
|
- |
|
83 |
public static <T> IncludeExclude<T> getNormalizedExclude(final Collection<? extends T> excludes) {
|
- |
|
84 |
return getNormalized(null, excludes);
|
- |
|
85 |
}
|
- |
|
86 |
|
60 |
public static <T> IncludeExclude<T> getNormalized(final Collection<? extends T> includes, final Collection<? extends T> excludes) {
|
87 |
public static <T> IncludeExclude<T> getNormalized(final Collection<? extends T> includes, final Collection<? extends T> excludes) {
|
61 |
return new IncludeExclude<T>(includes, excludes).normal;
|
88 |
return new IncludeExclude<T>(includes, excludes).normal;
|
62 |
}
|
89 |
}
|
63 |
|
90 |
|
64 |
private final Set<T> includes;
|
91 |
private final Set<T> includes;
|
Line 72... |
Line 99... |
72 |
/**
|
99 |
/**
|
73 |
* Create a new instance.
|
100 |
* Create a new instance.
|
74 |
*
|
101 |
*
|
75 |
* @param includes which objects to include, <code>null</code> meaning all.
|
102 |
* @param includes which objects to include, <code>null</code> meaning all.
|
76 |
* @param excludes which objects to exclude, <code>null</code> meaning all.
|
103 |
* @param excludes which objects to exclude, <code>null</code> meaning all.
|
- |
|
104 |
* @see #isIncluded(Object)
|
77 |
*/
|
105 |
*/
|
78 |
public IncludeExclude(final Collection<? extends T> includes, final Collection<? extends T> excludes) {
|
106 |
public IncludeExclude(final Collection<? extends T> includes, final Collection<? extends T> excludes) {
|
79 |
this(includes, excludes, false);
|
107 |
this(includes, excludes, false);
|
80 |
}
|
108 |
}
|
81 |
|
109 |
|