From 1e44a60d0d77debc349ac647e2b6dff38e01101a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= <ilpo.jarvinen@helsinki.fi>
Date: Mon, 3 Feb 2014 14:46:07 +0200
Subject: [PATCH 1/2] Don't open code test tree for components
---
.../data/validation/tests/ConditionalKeys.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java b/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java
index 89f6338..195798c 100644
a
|
b
|
public class ConditionalKeys extends Test.TagTest {
|
65 | 65 | return false; |
66 | 66 | } |
67 | 67 | final String[] parts = key.replaceAll(":conditional", "").split(":"); |
68 | | return parts.length == 3 && isRestrictionType(parts[0]) && isTransportationMode(parts[1]) && isDirection(parts[2]) |
69 | | || parts.length == 1 && (isRestrictionType(parts[0]) || isTransportationMode(parts[0])) |
70 | | || parts.length == 2 && ( |
71 | | isRestrictionType(parts[0]) && (isTransportationMode(parts[1]) || isDirection(parts[1])) |
72 | | || isTransportationMode(parts[0]) && isDirection(parts[1])); |
| 68 | int idx = 0; |
| 69 | |
| 70 | if (isRestrictionType(parts[idx])) |
| 71 | idx++; |
| 72 | if (isTransportationMode(parts[idx])) |
| 73 | idx++; |
| 74 | if (idx > 0 && isDirection(parts[idx])) |
| 75 | idx++; |
| 76 | return (idx > 0 && idx == parts.length); |
73 | 77 | } |
74 | 78 | |
75 | 79 | public boolean isValueValid(String key, String value) { |