2
* Copyright (C) 2008 Steve Ratcliffe
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
14
* Author: Steve Ratcliffe
15
* Create date: 07-Nov-2008
17
package uk.me.parabola.mkgmap.osmstyle;
19
import uk.me.parabola.mkgmap.osmstyle.eval.Op;
20
import uk.me.parabola.mkgmap.reader.osm.Element;
21
import uk.me.parabola.mkgmap.reader.osm.GType;
22
import uk.me.parabola.mkgmap.reader.osm.Rule;
25
* A rule that contains a condition. If the condition is matched by the
26
* element then the held gtype is returned.
28
* @author Steve Ratcliffe
30
public class ExpressionRule implements Rule {
31
private final Op exression;
32
private final GType gtype;
34
public ExpressionRule(Op exression, GType gtype) {
35
this.exression = exression;
39
public GType resolveType(Element el) {
40
if (exression.eval(el))
46
public String toString() {
47
return exression.toString() + ' ' + gtype;