-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConjunto.java
More file actions
85 lines (72 loc) · 1.52 KB
/
Conjunto.java
File metadata and controls
85 lines (72 loc) · 1.52 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
import java.util.ArrayList;
public class Conjunto extends ArrayList<Punto>
{
public boolean isChange = true;
/**
*
*/
private static final long serialVersionUID = 5014696924540648765L;
public Conjunto(Conjunto conjuntoCopia) {
super(conjuntoCopia);
}
public Conjunto() {
super();
}
public String toString() {
StringBuilder sb = new StringBuilder();
for(Punto p : this){
sb.append(p.toString()).append("\n");
}
return sb.toString();
}
/* (non-Javadoc)
* @see java.util.ArrayList#add(java.lang.Object)
*/
@Override
public boolean add(Punto e) {
isChange = true;
return super.add(e);
}
/* (non-Javadoc)
* @see java.util.ArrayList#remove(int)
*/
@Override
public Punto remove(int index) {
isChange = true;
return super.remove(index);
}
/* (non-Javadoc)
* @see java.util.ArrayList#remove(java.lang.Object)
*/
@Override
public boolean remove(Object o) {
isChange = true;
return super.remove(o);
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + (isChange ? 1231 : 1237);
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
Conjunto other = (Conjunto) obj;
if (isChange != other.isChange)
return false;
return true;
}
}