2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.parser.repo;
10 import java.util.Collection;
12 import org.opendaylight.yangtools.yang.model.api.source.SourceDependency;
13 import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
14 import org.opendaylight.yangtools.yang.model.spi.source.SourceInfo;
15 import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
17 final class RevisionDependencyResolver extends DependencyResolver {
18 RevisionDependencyResolver(final Map<SourceIdentifier, SourceInfo> depInfo) {
23 YangParserConfiguration parserConfig() {
24 return YangParserConfiguration.DEFAULT;
28 boolean isKnown(final Collection<SourceIdentifier> haystack, final SourceDependency dependency) {
30 return haystack.contains(new SourceIdentifier(dependency.name(), dependency.revision()))
31 // Slow revision-less walk
32 || dependency.revision() == null && haystack.stream().anyMatch(dependency::isSatisfiedBy);