record (PsiElement parent, List<Integer> childrenIndexes) { public PsiElement getElementCopy() { PsiElement result = parent.copy(); for (Integer nextIndex : childrenIndexes) { if (result != null && result.getChildren().length > nextIndex) { result = result.getChildren()[nextIndex]; } else { return null; } } return result; } public boolean hasPath() { return !childrenIndexes.isEmpty(); } }