★ wanayoo — archive 1999 https://github.com/TheAlgorithms/Java/pull/1260/filesNouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checker-Annotation #1260

Open
wants to merge 3 commits into
base: master
from
Open
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -14,6 +14,8 @@
*/

import java.util.*;
import org.checkerframework.common.value.qual.*;
import org.checkerframework.checker.index.qual.*;

public class Dijkstra {
private static final Graph.Edge[] GRAPH = {
@@ -47,16 +49,16 @@ public static void main(String[] args) {

class Graph {
// mapping of vertex names to Vertex objects, built from a set of Edges
private final Map<String, Vertex> graph;
private final Map<@NonNull String, Vertex> graph;

/**
* One edge of the graph (only used by Graph constructor)
*/
public static class Edge {
public final String v1, v2;
public final int dist;
public @NonNegative int dist;

public Edge(String v1, String v2, int dist) {
public Edge(String v1, String v2, @NonNegative int dist) {
this.v1 = v1;
this.v2 = v2;
this.dist = dist;
@@ -71,7 +73,7 @@ public Edge(String v1, String v2, int dist) {
// MAX_VALUE assumed to be infinity
public int dist = Integer.MAX_VALUE;
public Vertex previous = null;
public final Map<Vertex, Integer> neighbours = new HashMap<>();
public final Map<Vertex, @NonNegative Integer> neighbours = new HashMap<>();

public Vertex(String name) {
this.name = name;
@@ -189,4 +191,4 @@ public void printAllPaths() {
System.out.println();
}
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.