]> git.basschouten.com Git - openhab-addons.git/blob
e320c50615cdffcb204c6e3c9974a1e64d00e084
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.filter;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.deutschebahn.internal.timetable.dto.TimetableStop;
17
18 /**
19  * And conjunction for {@link TimetableStopPredicate}.
20  * 
21  * @author Sönke Küper - initial contribution
22  */
23 @NonNullByDefault
24 public final class AndPredicate implements TimetableStopPredicate {
25
26     private final TimetableStopPredicate first;
27     private final TimetableStopPredicate second;
28
29     /**
30      * Creates a new {@link AndPredicate}.
31      */
32     public AndPredicate(TimetableStopPredicate first, TimetableStopPredicate second) {
33         this.first = first;
34         this.second = second;
35     }
36
37     @Override
38     public boolean test(TimetableStop t) {
39         return first.test(t) && second.test(t);
40     }
41
42     /**
43      * Returns first argument.
44      */
45     TimetableStopPredicate getFirst() {
46         return first;
47     }
48
49     /**
50      * Returns second argument.
51      */
52     TimetableStopPredicate getSecond() {
53         return second;
54     }
55 }