001 /*
002 * SPDX-License-Identifier: Apache-2.0
003 *
004 * Copyright 2008-2017 the original author or authors.
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 package griffon.javafx
019
020 import griffon.javafx.beans.binding.MatchingBindings
021 import groovy.transform.CompileStatic
022 import javafx.beans.binding.BooleanBinding
023 import javafx.beans.value.ObservableValue
024 import javafx.collections.ObservableList
025 import javafx.collections.ObservableMap
026 import javafx.collections.ObservableSet
027
028 import javax.annotation.Nonnull
029 import java.util.function.Function
030 import java.util.function.Predicate
031
032 /**
033 * @author Andres Almiray
034 * @since 2.13.0
035 */
036 @CompileStatic
037 final class MatchingBindingsExtension {
038 @Nonnull
039 static <T> BooleanBinding anyMatch(@Nonnull ObservableList<T> self, @Nonnull Predicate<? super T> predicate) {
040 MatchingBindings.anyMatch(self, predicate)
041 }
042
043 @Nonnull
044 static <T, R> BooleanBinding anyMatch(
045 @Nonnull ObservableList<T> self,
046 @Nonnull Function<? super T, R> mapper, @Nonnull Predicate<? super R> predicate) {
047 MatchingBindings.anyMatch(self, mapper, predicate)
048 }
049
050 @Nonnull
051 static <T> BooleanBinding anyMatch(
052 @Nonnull ObservableList<T> self, @Nonnull ObservableValue<Predicate<? super T>> predicate) {
053 MatchingBindings.anyMatch(self, predicate)
054 }
055
056 @Nonnull
057 static <T, R> BooleanBinding anyMatch(
058 @Nonnull ObservableList<T> self,
059 @Nonnull ObservableValue<Function<? super T, R>> mapper,
060 @Nonnull ObservableValue<Predicate<? super R>> predicate) {
061 MatchingBindings.anyMatch(self, mapper, predicate)
062 }
063
064 @Nonnull
065 static <T> BooleanBinding noneMatch(@Nonnull ObservableList<T> self, @Nonnull Predicate<? super T> predicate) {
066 MatchingBindings.noneMatch(self, predicate)
067 }
068
069 @Nonnull
070 static <T, R> BooleanBinding noneMatch(
071 @Nonnull ObservableList<T> self,
072 @Nonnull Function<? super T, R> mapper, @Nonnull Predicate<? super R> predicate) {
073 MatchingBindings.noneMatch(self, mapper, predicate)
074 }
075
076 @Nonnull
077 static <T> BooleanBinding noneMatch(
078 @Nonnull ObservableList<T> self, @Nonnull ObservableValue<Predicate<? super T>> predicate) {
079 MatchingBindings.noneMatch(self, predicate)
080 }
081
082 @Nonnull
083 static <T, R> BooleanBinding noneMatch(
084 @Nonnull ObservableList<T> self,
085 @Nonnull ObservableValue<Function<? super T, R>> mapper,
086 @Nonnull ObservableValue<Predicate<? super R>> predicate) {
087 MatchingBindings.noneMatch(self, mapper, predicate)
088 }
089
090 @Nonnull
091 static <T> BooleanBinding allMatch(@Nonnull ObservableList<T> self, @Nonnull Predicate<? super T> predicate) {
092 MatchingBindings.allMatch(self, predicate)
093 }
094
095 @Nonnull
096 static <T, R> BooleanBinding allMatch(
097 @Nonnull ObservableList<T> self,
098 @Nonnull Function<? super T, R> mapper, @Nonnull Predicate<? super R> predicate) {
099 MatchingBindings.allMatch(self, mapper, predicate)
100 }
101
102 @Nonnull
103 static <T> BooleanBinding allMatch(
104 @Nonnull ObservableList<T> self, @Nonnull ObservableValue<Predicate<? super T>> predicate) {
105 MatchingBindings.allMatch(self, predicate)
106 }
107
108 @Nonnull
109 static <T, R> BooleanBinding allMatch(
110 @Nonnull ObservableList<T> self,
111 @Nonnull ObservableValue<Function<? super T, R>> mapper,
112 @Nonnull ObservableValue<Predicate<? super R>> predicate) {
113 MatchingBindings.allMatch(self, mapper, predicate)
114 }
115
116 @Nonnull
117 static <T> BooleanBinding anyMatch(@Nonnull ObservableSet<T> self, @Nonnull Predicate<? super T> predicate) {
118 MatchingBindings.anyMatch(self, predicate)
119 }
120
121 @Nonnull
122 static <T, R> BooleanBinding anyMatch(
123 @Nonnull ObservableSet<T> self,
124 @Nonnull Function<? super T, R> mapper, @Nonnull Predicate<? super R> predicate) {
125 MatchingBindings.anyMatch(self, mapper, predicate)
126 }
127
128 @Nonnull
129 static <T> BooleanBinding anyMatch(
130 @Nonnull ObservableSet<T> self, @Nonnull ObservableValue<Predicate<? super T>> predicate) {
131 MatchingBindings.anyMatch(self, predicate)
132 }
133
134 @Nonnull
135 static <T, R> BooleanBinding anyMatch(
136 @Nonnull ObservableSet<T> self,
137 @Nonnull ObservableValue<Function<? super T, R>> mapper,
138 @Nonnull ObservableValue<Predicate<? super R>> predicate) {
139 MatchingBindings.anyMatch(self, mapper, predicate)
140 }
141
142 @Nonnull
143 static <T> BooleanBinding noneMatch(@Nonnull ObservableSet<T> self, @Nonnull Predicate<? super T> predicate) {
144 MatchingBindings.noneMatch(self, predicate)
145 }
146
147 @Nonnull
148 static <T, R> BooleanBinding noneMatch(
149 @Nonnull ObservableSet<T> self,
150 @Nonnull Function<? super T, R> mapper, @Nonnull Predicate<? super R> predicate) {
151 MatchingBindings.noneMatch(self, mapper, predicate)
152 }
153
154 @Nonnull
155 static <T> BooleanBinding noneMatch(
156 @Nonnull ObservableSet<T> self, @Nonnull ObservableValue<Predicate<? super T>> predicate) {
157 MatchingBindings.noneMatch(self, predicate)
158 }
159
160 @Nonnull
161 static <T, R> BooleanBinding noneMatch(
162 @Nonnull ObservableSet<T> self,
163 @Nonnull ObservableValue<Function<? super T, R>> mapper,
164 @Nonnull ObservableValue<Predicate<? super R>> predicate) {
165 MatchingBindings.noneMatch(self, mapper, predicate)
166 }
167
168 @Nonnull
169 static <T> BooleanBinding allMatch(@Nonnull ObservableSet<T> self, @Nonnull Predicate<? super T> predicate) {
170 MatchingBindings.allMatch(self, predicate)
171 }
172
173 @Nonnull
174 static <T, R> BooleanBinding allMatch(
175 @Nonnull ObservableSet<T> self,
176 @Nonnull Function<? super T, R> mapper, @Nonnull Predicate<? super R> predicate) {
177 MatchingBindings.allMatch(self, mapper, predicate)
178 }
179
180 @Nonnull
181 static <T> BooleanBinding allMatch(
182 @Nonnull ObservableSet<T> self, @Nonnull ObservableValue<Predicate<? super T>> predicate) {
183 MatchingBindings.allMatch(self, predicate)
184 }
185
186 @Nonnull
187 static <T, R> BooleanBinding allMatch(
188 @Nonnull ObservableSet<T> self,
189 @Nonnull ObservableValue<Function<? super T, R>> mapper,
190 @Nonnull ObservableValue<Predicate<? super R>> predicate) {
191 MatchingBindings.allMatch(self, mapper, predicate)
192 }
193
194 @Nonnull
195 static <K, V> BooleanBinding anyMatch(@Nonnull ObservableMap<K, V> self, @Nonnull Predicate<? super V> predicate) {
196 MatchingBindings.anyMatch(self, predicate)
197 }
198
199 @Nonnull
200 static <K, V, R> BooleanBinding anyMatch(
201 @Nonnull ObservableMap<K, V> self,
202 @Nonnull Function<? super V, R> mapper, @Nonnull Predicate<? super R> predicate) {
203 MatchingBindings.anyMatch(self, mapper, predicate)
204 }
205
206 @Nonnull
207 static <K, V> BooleanBinding anyMatch(
208 @Nonnull ObservableMap<K, V> self, @Nonnull ObservableValue<Predicate<? super V>> predicate) {
209 MatchingBindings.anyMatch(self, predicate)
210 }
211
212 @Nonnull
213 static <K, V, R> BooleanBinding anyMatch(
214 @Nonnull ObservableMap<K, V> self,
215 @Nonnull ObservableValue<Function<? super V, R>> mapper,
216 @Nonnull ObservableValue<Predicate<? super R>> predicate) {
217 MatchingBindings.anyMatch(self, mapper, predicate)
218 }
219
220 @Nonnull
221 static <K, V> BooleanBinding noneMatch(@Nonnull ObservableMap<K, V> self, @Nonnull Predicate<? super V> predicate) {
222 MatchingBindings.noneMatch(self, predicate)
223 }
224
225 @Nonnull
226 static <K, V, R> BooleanBinding noneMatch(
227 @Nonnull ObservableMap<K, V> self,
228 @Nonnull Function<? super V, R> mapper, @Nonnull Predicate<? super R> predicate) {
229 MatchingBindings.noneMatch(self, mapper, predicate)
230 }
231
232 @Nonnull
233 static <K, V> BooleanBinding noneMatch(
234 @Nonnull ObservableMap<K, V> self, @Nonnull ObservableValue<Predicate<? super V>> predicate) {
235 MatchingBindings.noneMatch(self, predicate)
236 }
237
238 @Nonnull
239 static <K, V, R> BooleanBinding noneMatch(
240 @Nonnull ObservableMap<K, V> self,
241 @Nonnull ObservableValue<Function<? super V, R>> mapper,
242 @Nonnull ObservableValue<Predicate<? super R>> predicate) {
243 MatchingBindings.noneMatch(self, mapper, predicate)
244 }
245
246 @Nonnull
247 static <K, V> BooleanBinding allMatch(@Nonnull ObservableMap<K, V> self, @Nonnull Predicate<? super V> predicate) {
248 MatchingBindings.allMatch(self, predicate)
249 }
250
251 @Nonnull
252 static <K, V, R> BooleanBinding allMatch(
253 @Nonnull ObservableMap<K, V> self,
254 @Nonnull Function<? super V, R> mapper, @Nonnull Predicate<? super R> predicate) {
255 MatchingBindings.allMatch(self, mapper, predicate)
256 }
257
258 @Nonnull
259 static <K, V> BooleanBinding allMatch(
260 @Nonnull ObservableMap<K, V> self, @Nonnull ObservableValue<Predicate<? super V>> predicate) {
261 MatchingBindings.allMatch(self, predicate)
262 }
263
264 @Nonnull
265 static <K, V, R> BooleanBinding allMatch(
266 @Nonnull ObservableMap<K, V> self,
267 @Nonnull ObservableValue<Function<? super V, R>> mapper,
268 @Nonnull ObservableValue<Predicate<? super R>> predicate) {
269 MatchingBindings.allMatch(self, mapper, predicate)
270 }
271 }
|