ArrangementSectionRuleData (@NotNull ArrangementMatchCondition condition) { final Ref<Boolean> isStart = new Ref<>(); final Ref<String> text = new Ref<>(); condition.invite(new ArrangementMatchConditionVisitor() { @Override public void visit(@NotNull ArrangementAtomMatchCondition condition) { final ArrangementSettingsToken type = condition.getType(); if (type.equals(START_SECTION)) { isStart.set(true); } else if (type.equals(END_SECTION)) { isStart.set(false); } else if (type.equals(TEXT)) { text.set(condition.getValue().toString()); } } @Override public void visit(@NotNull ArrangementCompositeMatchCondition condition) { for (ArrangementMatchCondition c : condition.getOperands()) { c.invite(this); if (!text.isNull() && !isStart.isNull()) { return; } } } }); if (isStart.isNull()) { return null; } return new ArrangementSectionRuleData(processSectionText(StringUtil.notNullize(text.get())), isStart.get()); }