/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ *
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
import org.opendaylight.yangtools.yang.model.api.Module;
*/
public final class ModuleDependencySort {
- private static final Date DEFAULT_REVISION = new Date(0);
+ private static final Date DEFAULT_REVISION = SimpleDateFormatUtil.DEFAULT_DATE_REV;
private static final Logger LOGGER = LoggerFactory.getLogger(ModuleDependencySort.class);
private static final Function<Node, Module> TOPOLOGY_FUNCTION = new Function<TopologicalSort.Node, Module>() {
@Override
/**
* Topological sort of module builder dependency graph.
*
+ * @param builders builders of Module object
* @return Sorted list of Module builders. Modules can be further processed
* in returned order.
*/
/**
* Topological sort of module dependency graph.
*
+ * @param modules YANG modules
* @return Sorted list of Modules. Modules can be further processed in
* returned order.
*/
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((revision == null) ? 0 : revision.hashCode());
+ result = prime * result + Objects.hashCode(name);
+ result = prime * result + Objects.hashCode(revision);
return result;
}