-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass.java
More file actions
87 lines (75 loc) · 2.21 KB
/
Class.java
File metadata and controls
87 lines (75 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import java.util.*;
/**
* class represent for Class
*/
public class Class extends Interface{
// the Class is Abstract or not
private boolean Abstract = false;
// parents of the Class
private Class parents = null;
/**
* Constructor of Class
*/
public Class(){
super();
}
/**
* set parents for this Class
* @param parents the parents
*/
public void setParents(Class parents) {
this.parents = parents;
}
/**
* get parents of this Class
* @return the parents
*/
public Class getParents() {
return parents;
}
/**
* check if the Class is abstract
* @return abstract or not
*/
public boolean isAbstract() {
return Abstract;
}
/**
* set the Class is abstract or not
* @param Abstract abstract or not
*/
public void setAbstract(boolean Abstract) {
this.Abstract = Abstract;
}
@Override
public String toString() {
String toString = "Class: "+getName();
toString += (isAbstract())? " is abstract\n" : "\n";
if (parents!=null) toString += (" - parents: "+ parents.getName()+"\n");
if (interfaces.size()!=0) {
toString += (" - interface: ");
for (int i=0; i<interfaces.size(); i++)
toString += (interfaces.get(i).getName() + " ");
toString += ("\n");
}
if (properties.size()!=0) {
toString += (" - property: \n");
Set set = properties.entrySet();
Iterator i = set.iterator();
while (i.hasNext()) {
Map.Entry me = (Map.Entry) i.next();
toString += (" + "+properties.get(me.getKey()) + '\n');
}
}
if (methods.size()!=0) {
toString += (" - method: \n");
Set set = methods.entrySet();
Iterator i = set.iterator();
while (i.hasNext()) {
Map.Entry me = (Map.Entry) i.next();
toString += (" + "+methods.get(me.getKey()) + '\n');
}
}
return toString;
}
}