1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.orangesignal.csv.filters;
18
19 import java.util.List;
20
21
22
23
24
25
26
27 public class ColumnNameBetweenExpression extends ColumnNameExpression {
28
29
30
31
32 private String low;
33
34
35
36
37 private String high;
38
39
40
41
42
43
44
45
46
47 protected ColumnNameBetweenExpression(final String name, final String low, final String high) {
48 super(name);
49 if (low == null || high == null) {
50 throw new IllegalArgumentException("Low or High must not be null");
51 }
52 this.low = low;
53 this.high = high;
54 }
55
56 @Override
57 public boolean accept(final List<String> header, final List<String> values) {
58 final int position = header.indexOf(name);
59 if (position == -1) {
60 throw new IllegalArgumentException(String.format("Invalid column name %s", name));
61 }
62 return CsvExpressionUtils.between(values, position, low, high);
63 }
64
65 }