Self (final @NotNull ElementPattern<? super ParentType> pattern) { return with(new PatternCondition<T>("isFirstAcceptedChild") { @Override public boolean accepts(final @NotNull T t, final ProcessingContext context) { final ParentType parent = getParent(t); if (parent != null) { final ParentType[] children = getChildren(parent); for (ParentType child : children) { if (pattern.accepts(child, context)) { return child == t; } } } return false; } }); }