View Javadoc
1   /*
2    * SPDX-FileCopyrightText: Copyright (c) 2011-2026 Yegor Bugayenko
3    * SPDX-License-Identifier: MIT
4    */
5   package com.qulice.checkstyle;
6   
7   import com.google.common.base.Predicate;
8   
9   /**
10   * Predicate to determine if a given line is within range of any of
11   * the line ranges.
12   *
13   * @since 0.1
14   */
15  final class LineWithAny implements Predicate<LineRange> {
16  
17      /**
18       * The given line.
19       */
20      private final int given;
21  
22      /**
23       * Default constructor.
24       *
25       * @param line The given line to check against all the line ranges
26       */
27      LineWithAny(final int line) {
28          this.given = line;
29      }
30  
31      @Override
32      public boolean apply(final LineRange range) {
33          return range != null && range.within(this.given);
34      }
35  }