Fix rendering parser

This commit is contained in:
Victor Shcherb 2014-09-13 17:18:26 +02:00
parent a25a2a23b9
commit 8a23993e08

View file

@ -157,22 +157,21 @@ public class RenderingRulesStorage {
int tag = getDictionaryValue(tagS); int tag = getDictionaryValue(tagS);
int value = getDictionaryValue(valueS); int value = getDictionaryValue(valueS);
int key = (tag << SHIFT_TAG_VAL) + value; int key = (tag << SHIFT_TAG_VAL) + value;
RenderingRule toInsert = rr; RenderingRule insert = tagValueGlobalRules[state].get(key);
RenderingRule previous = tagValueGlobalRules[state].get(key); if (insert != null) {
if(previous != null){
// all root rules should have at least tag/value // all root rules should have at least tag/value
toInsert = createTagValueRootWrapperRule(key, previous); insert = createTagValueRootWrapperRule(key, insert);
toInsert.addIfElseChildren(rr); insert.addIfElseChildren(rr);
} else {
insert = rr;
} }
tagValueGlobalRules[state].put(key, toInsert); tagValueGlobalRules[state].put(key, insert);
} }
private RenderingRule createTagValueRootWrapperRule(int tagValueKey, RenderingRule previous) { private RenderingRule createTagValueRootWrapperRule(int tagValueKey, RenderingRule previous) {
if (previous.getProperties().length > 0) { if (previous.getProperties().length > 0) {
Map<String, String> m = new HashMap<String, String>(); Map<String, String> m = new HashMap<String, String>();
m.put("tag", getTagString(tagValueKey));
m.put("value", getValueString(tagValueKey));
RenderingRule toInsert = new RenderingRule(m, true, RenderingRulesStorage.this); RenderingRule toInsert = new RenderingRule(m, true, RenderingRulesStorage.this);
toInsert.addIfElseChildren(previous); toInsert.addIfElseChildren(previous);
return toInsert; return toInsert;