mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 06:23:08 +08:00
style: enable RedundantModifier
in checkstyle (#5140)
This commit is contained in:
@ -14,7 +14,7 @@ public class A_Star {
|
||||
private ArrayList<ArrayList<Edge>> graph;
|
||||
|
||||
// Initialise ArrayLists in Constructor
|
||||
public Graph(int size) {
|
||||
Graph(int size) {
|
||||
this.graph = new ArrayList<>();
|
||||
for (int i = 0; i < size; i++) {
|
||||
this.graph.add(new ArrayList<>());
|
||||
@ -38,7 +38,7 @@ public class A_Star {
|
||||
private int to;
|
||||
private int weight;
|
||||
|
||||
public Edge(int from, int to, int weight) {
|
||||
Edge(int from, int to, int weight) {
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.weight = weight;
|
||||
@ -64,7 +64,7 @@ public class A_Star {
|
||||
private ArrayList<Integer> path; // list of visited nodes in this path.
|
||||
private int estimated; // heuristic value associated to the last node od the path (current node).
|
||||
|
||||
public PathAndDistance(int distance, ArrayList<Integer> path, int estimated) {
|
||||
PathAndDistance(int distance, ArrayList<Integer> path, int estimated) {
|
||||
this.distance = distance;
|
||||
this.path = path;
|
||||
this.estimated = estimated;
|
||||
|
@ -31,7 +31,7 @@ class BellmanFord /*
|
||||
* @param v End vertex
|
||||
* @param c Weight
|
||||
*/
|
||||
public Edge(int a, int b, int c) {
|
||||
Edge(int a, int b, int c) {
|
||||
u = a;
|
||||
v = b;
|
||||
w = c;
|
||||
|
@ -15,7 +15,7 @@ class Graph<E extends Comparable<E>> {
|
||||
|
||||
E name;
|
||||
|
||||
public Node(E name) {
|
||||
Node(E name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@ -24,7 +24,7 @@ class Graph<E extends Comparable<E>> {
|
||||
|
||||
Node startNode, endNode;
|
||||
|
||||
public Edge(Node startNode, Node endNode) {
|
||||
Edge(Node startNode, Node endNode) {
|
||||
this.startNode = startNode;
|
||||
this.endNode = endNode;
|
||||
}
|
||||
@ -33,7 +33,7 @@ class Graph<E extends Comparable<E>> {
|
||||
ArrayList<Edge> edgeList;
|
||||
ArrayList<Node> nodeList;
|
||||
|
||||
public Graph() {
|
||||
Graph() {
|
||||
edgeList = new ArrayList<Edge>();
|
||||
nodeList = new ArrayList<Node>();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ class Cycle {
|
||||
private boolean[] visited;
|
||||
ArrayList<ArrayList<Integer>> cycles = new ArrayList<ArrayList<Integer>>();
|
||||
|
||||
public Cycle() {
|
||||
Cycle() {
|
||||
Scanner in = new Scanner(System.in);
|
||||
System.out.print("Enter the no. of nodes: ");
|
||||
nodes = in.nextInt();
|
||||
|
@ -6,7 +6,7 @@ class AdjacencyListGraph<E extends Comparable<E>> {
|
||||
|
||||
ArrayList<Vertex> vertices;
|
||||
|
||||
public AdjacencyListGraph() {
|
||||
AdjacencyListGraph() {
|
||||
vertices = new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ class AdjacencyListGraph<E extends Comparable<E>> {
|
||||
E data;
|
||||
ArrayList<Vertex> adjacentVertices;
|
||||
|
||||
public Vertex(E data) {
|
||||
Vertex(E data) {
|
||||
adjacentVertices = new ArrayList<>();
|
||||
this.data = data;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class Kruskal {
|
||||
private int to;
|
||||
private int weight;
|
||||
|
||||
public Edge(int from, int to, int weight) {
|
||||
Edge(int from, int to, int weight) {
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.weight = weight;
|
||||
|
@ -68,7 +68,7 @@ class AdjacencyMatrixGraph {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public AdjacencyMatrixGraph(int givenNumberOfVertices) {
|
||||
AdjacencyMatrixGraph(int givenNumberOfVertices) {
|
||||
this.setNumberOfVertices(givenNumberOfVertices);
|
||||
this.setNumberOfEdges(0);
|
||||
this.setAdjacency(new int[givenNumberOfVertices][givenNumberOfVertices]);
|
||||
|
Reference in New Issue
Block a user