2 * Copyright (c) 2013 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.util;
10 import java.util.Arrays;
11 import java.util.List;
12 import org.opendaylight.yangtools.yang.model.api.Module;
15 * Creates a module dependency graph from provided {@link Module}s and
16 * provides a {@link #sort(Module...)} method. It is topological sort and
17 * returns modules in order in which they should be processed (e.g. if A imports
18 * B, sort returns {B, A}).
20 * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.ModuleDependencySort} instead.
23 public final class ModuleDependencySort {
25 * It is not desirable to instance this class.
27 private ModuleDependencySort() {
31 * Topological sort of module dependency graph.
33 * @param modules YANG modules
34 * @return Sorted list of Modules. Modules can be further processed in
37 public static List<Module> sort(final Module... modules) {
38 return sort(Arrays.asList(modules));
42 * Topological sort of module dependency graph.
44 * @param modules YANG modules
45 * @return Sorted list of Modules. Modules can be further processed in
48 public static List<Module> sort(final Iterable<Module> modules) {
50 return org.opendaylight.yangtools.yang.model.util.ModuleDependencySort.sort(modules);
51 } catch (IllegalArgumentException ex) {
52 throw new YangValidationException(ex.getMessage(), ex);