From 3d83c188e08c2a5395d4e71c974ede105dc7c567 Mon Sep 17 00:00:00 2001 From: Emux Date: Sat, 3 Sep 2016 22:42:39 +0300 Subject: [PATCH] Render theme positive rules building, fixes #156 --- vtm/src/org/oscim/theme/rule/RuleBuilder.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/vtm/src/org/oscim/theme/rule/RuleBuilder.java b/vtm/src/org/oscim/theme/rule/RuleBuilder.java index d9ec7f2d6..101b7ade4 100644 --- a/vtm/src/org/oscim/theme/rule/RuleBuilder.java +++ b/vtm/src/org/oscim/theme/rule/RuleBuilder.java @@ -1,6 +1,7 @@ /* * Copyright 2014 Hannes Janetzek - * + * Copyright 2016 devemux86 + * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * * This program is free software: you can redistribute it and/or modify it under the @@ -25,13 +26,11 @@ import org.oscim.theme.rule.Rule.PositiveRuleV; import org.oscim.theme.styles.RenderStyle; import org.oscim.theme.styles.RenderStyle.StyleBuilder; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.ArrayList; +import java.util.Collections; public class RuleBuilder { - final static Logger log = LoggerFactory.getLogger(RuleBuilder.class); private final static String[] EMPTY_KV = {}; @@ -49,8 +48,8 @@ public enum RuleType { String keys[]; String values[]; - ArrayList renderStyles = new ArrayList(4); - ArrayList subRules = new ArrayList(4); + ArrayList renderStyles = new ArrayList<>(4); + ArrayList subRules = new ArrayList<>(4); StyleBuilder[] styleBuilder; private static final String STRING_NEGATION = "~"; @@ -166,7 +165,7 @@ public Rule onComplete(int[] level) { return new NegativeRule(type, element, zoom, selector, keys, values, rules, styles); - if (numKeys == 1 && numKeys == 0) + if (numKeys == 1 && numVals == 0) return new PositiveRuleK(element, zoom, selector, keys[0], rules, styles); @@ -199,8 +198,7 @@ public RuleBuilder style(StyleBuilder... styles) { } public RuleBuilder rules(RuleBuilder... rules) { - for (RuleBuilder rule : rules) - subRules.add(rule); + Collections.addAll(subRules, rules); return this; }