View Javadoc
1   /*
2    * This file is part of ***  M y C o R e  ***
3    * See http://www.mycore.de/ for details.
4    *
5    * MyCoRe is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU General Public License as published by
7    * the Free Software Foundation, either version 3 of the License, or
8    * (at your option) any later version.
9    *
10   * MyCoRe is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License
16   * along with MyCoRe.  If not, see <http://www.gnu.org/licenses/>.
17   */
18  
19  package org.mycore.parsers.bool;
20  
21  /**
22   * @author Frank Lützenkirchen
23   */
24  public class MCROrCondition<T> extends MCRSetCondition<T> {
25  
26      public MCROrCondition() {
27          super("or");
28      }
29  
30      @SafeVarargs
31      public MCROrCondition(MCRCondition<T>... conditions) {
32          this();
33          for (MCRCondition<T> mcrCondition : conditions) {
34              addChild(mcrCondition);
35          }
36      }
37  
38      @Override
39      public boolean evaluate(T o) {
40          return children.stream().anyMatch(child -> child.evaluate(o));
41      }
42  }