2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
3 * Copyright (c) 2021 PANTHEON.tech, s.r.o.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.yangtools.concepts;
12 * An {@link Identifier} tied to some tree-like structure, similar to how {@link java.nio.file.Path} is tied to a
13 * conceptual file system. In addition to equivalence class implied by Identifier, the hierarchical nature of these
14 * identifiers also introduces a notion of containment: a HierarchicalIdentifier is said to contain another
15 * HierarchicalIdentifier if the former points to an ancestor node of the node pointed to by the latter in the same
16 * instance of the tree-like structure they are defined on. This property is expressed through
17 * {@link #contains(HierarchicalIdentifier)}.
19 public interface HierarchicalIdentifier<T extends HierarchicalIdentifier<T>> extends Identifier {
21 * Check if this identifier contains some other identifier. If we take HierarchicalIdentifier to be similar to a
22 * {@link java.nio.file.Path}, this is method is the equivalent of {@code other.startsWith(this)}.
24 * @param other Other identifier, may not be null
25 * @return True if this identifier contains the other identifier
26 * @throws NullPointerException if {@code other} is null
28 boolean contains(T other);