blob: 7659b0794899d48b229338342156536ae2b649d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/**
* Copyright (C) 2013 TomTom International B.V.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.genivi.trafficincidentsservice.refimpl;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.emf.ecore.EObject;
import org.genivi.booleanexpr.BooleanExpression;
public class ExpressionFilter extends Filter {
private final static Logger LOGGER = Logger.getLogger(ExpressionFilter.class.getName());
private BooleanExpression expression;
public ExpressionFilter(BooleanExpression expression) {
super();
LOGGER.setLevel(Level.SEVERE);
this.expression = expression;
}
@Override
public boolean filter(EObject object) {
LOGGER.info("=> Object = " + object.toString());
LOGGER.info("=> FilterExpression = " + expression.toString());
boolean returnValue = expression.evaluate(object);
LOGGER.info("<= " + returnValue);
return returnValue;
}
public BooleanExpression getExpression() {
return expression;
}
}
|