List<StdArrangementMatchRule> (@NotNull final StdArrangementMatchRule rule, @NotNull final Map<String, StdArrangementRuleAliasToken> tokenIdToDefinition) { final List<StdArrangementMatchRule> seqRule = new SmartList<>(); rule.getMatcher().getCondition().invite(new ArrangementMatchConditionVisitor() { @Override public void visit(@NotNull ArrangementAtomMatchCondition condition) { final StdArrangementRuleAliasToken token = tokenIdToDefinition.get(condition.getType().getId()); if (token != null && !token.getDefinitionRules().isEmpty()) { seqRule.addAll(token.getDefinitionRules()); } } @Override public void visit(@NotNull ArrangementCompositeMatchCondition condition) { for (ArrangementMatchCondition operand : condition.getOperands()) { if (!seqRule.isEmpty()) { return; } operand.invite(this); } } }); return seqRule; }