boolean (@NotNull AbstractTreeStructure structure, Object element) { if (element == null) return false; if (element instanceof AbstractTreeNode) { AbstractTreeNode<?> node = (AbstractTreeNode<?>)element; if (null == node.getValue()) { return false; } } if (element instanceof ValidateableNode) { ValidateableNode node = (ValidateableNode)element; if (!node.isValid()) return false; } return structure.isValid(element); }