Skip to content

Commit c06204f

Browse files
committed
Added some meaningfull method and class level comments
1 parent 5cb1d0a commit c06204f

3 files changed

Lines changed: 61 additions & 2 deletions

File tree

JavaDateAndTime.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
public class JavaDateAndTime {
77
static List<String> days = Arrays.asList("SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY");
88

9+
/**
10+
* Gives the Day of the week(SUNDAY,MONDAY...) based on the passed params
11+
* @param day
12+
* @param month
13+
* @param year
14+
* @return
15+
*/
916
public static String getDay(String day, String month, String year) {
1017

1118
int y = Integer.parseInt(year);

University.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
/**
2+
* This class represents University and contains it's child domain classes(Course, Student, Sem, Department and Institute)
3+
*/
14
package javacodes;
25

36
import java.util.*;
47

8+
/**
9+
* This class is to represnt a Student
10+
*
11+
*/
512
class Students
613
{
714
String name="";
@@ -34,6 +41,11 @@ void getstu()
3441
System.out.println(name+"\t"+roll+"\t"+cgpa);
3542
}
3643
}
44+
45+
/**
46+
* This class is to represent a Semester with containing students and other information
47+
*
48+
*/
3749
class Sem
3850
{
3951
ArrayList<Students> li;
@@ -87,6 +99,10 @@ void showsem()
8799
}
88100
}
89101
}
102+
/**
103+
* This class represnts a Course in a Institute
104+
*
105+
*/
90106
class Course
91107
{
92108
String name;
@@ -136,6 +152,10 @@ void showcourse()
136152
}
137153
}
138154
}
155+
/**
156+
* This class represents a Department in a Institute
157+
*
158+
*/
139159
class Department
140160
{
141161
String name;
@@ -185,6 +205,10 @@ void showdept()
185205
}
186206
}
187207
}
208+
/**
209+
* This class represents an Institute
210+
*
211+
*/
188212
class Institute
189213
{
190214
String name;
@@ -234,6 +258,10 @@ void showinst()
234258
}
235259
}
236260
}
261+
/**
262+
* This class represents a University containing one or more Institute
263+
*
264+
*/
237265
public class University {
238266

239267
public static void main(String[] args)

WebGraph.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package javacodes;
2-
2+
/**
3+
* This class is to represent a Graph and to perform some operation in Graph
4+
*/
35
import java.util.*;
46

57

@@ -11,6 +13,10 @@ class WebGraph
1113
private int dist[];
1214
private int par[];
1315

16+
/**
17+
* Constructor to create a WebGraph
18+
* @param v
19+
*/
1420
WebGraph(int v)
1521
{
1622
V = v;
@@ -27,13 +33,21 @@ class WebGraph
2733
}
2834
}
2935

30-
36+
/**
37+
* This is to add an edge in the WebGraph with Vertices v and Weight w
38+
* @param v
39+
* @param w
40+
*/
3141
void addEdge(int v,int w)
3242
{
3343
adj[v].add(w);
3444
}
3545

3646

47+
/**
48+
* This api performs Breadth First Search in (this)WebGraph
49+
* @param s
50+
*/
3751
void BFS(int s)
3852
{
3953

@@ -80,6 +94,13 @@ void BFS(int s)
8094
}
8195
}
8296

97+
/**
98+
* Thus api prints a path(showing all the vertices in between s and d
99+
* vertices) from Source vertices s to Destination vertices d
100+
*
101+
* @param s
102+
* @param d
103+
*/
83104
void path(int s,int d)
84105
{
85106
BFS(s);
@@ -97,6 +118,9 @@ void path(int s,int d)
97118
System.out.println("\nDistance form "+s+" to "+d+" is : "+dist[d]);
98119

99120
}
121+
/**
122+
* This api prints the diameter of this WebGraph
123+
*/
100124
void diameter()
101125
{
102126
int max=Integer.MIN_VALUE;

0 commit comments

Comments
 (0)