]> git.basschouten.com Git - openhab-addons.git/blob
e0256f42453e93222d51db0d393226d0aa80217e
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.deutschebahn.internal;
14
15 import java.util.function.Predicate;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.openhab.binding.deutschebahn.internal.timetable.dto.TimetableStop;
19
20 /**
21  * Filter that selects {@link TimetableStop}, if they have an departure or an arrival element (or both).
22  * 
23  * @author Sönke Küper - initial contribution.
24  */
25 @NonNullByDefault
26 public enum TimetableStopFilter implements Predicate<TimetableStop> {
27
28     /**
29      * Selects all entries.
30      */
31     ALL {
32         @Override
33         public boolean test(TimetableStop t) {
34             return true;
35         }
36     },
37
38     /**
39      * Selects only stops with an departure.
40      */
41     DEPARTURES {
42         @Override
43         public boolean test(TimetableStop t) {
44             return t.getDp() != null;
45         }
46     },
47
48     /**
49      * Selects only stops with an arrival.
50      */
51     ARRIVALS {
52         @Override
53         public boolean test(TimetableStop t) {
54             return t.getAr() != null;
55         }
56     };
57 }