gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control systemdiff --git a/Hash/hash.txt b/Hash/hash.txt
--- a/Hash/hash.txt
+++ b/Hash/hash.txt
Kancelarija k2 = (Kancelarija) o;
// Prvo proveravamo broj
- if (broj != other.broj) {
+ if (broj != k2.broj) {
return false;
}
// A potom prezime
- if (!Objects.equals(prezime, other.prezime)) {
+ if (!Objects.equals(prezime, k2.prezime)) {
return false;
}
}
Gadjanje o2 = (Gadjanje) o;
- if (o2.rezultati.length == rezultati.length) {
- for (int i = 0; i < rezultati.length; i++) {
- if (o2.rezultati[i] != rezultati[i])
- return false;
+ // proveravamo da li je polje null pre dalje provere
+ if (rezultati != null && o2.rezultati != null) {
+ if (o2.rezultati.length == rezultati.length) {
+ for (int i = 0; i < rezultati.length; i++) {
+ if (o2.rezultati[i] != rezultati[i]){
+ // cim je nesto razlicito nisu isti
+ return false;
+ }
+ }
+ // ako se sve vrednosti slazu isti su
+ return true;
}
- return true;
+ return false;
+ } else {
+ // vracamo da li su oba null, tj da li su jednaki
+ return (rezultati == null && o2.rezultati == null);
}
- return false;
}
```
if (getClass() != o.getClass()) {
return false;
}
+
+ // menjamo tip da mozemo da poredimo
XO o2 = (XO) o;
+ // posto je u ovoj klasi uvek inicijalizovano polje table
+ // i uvek je DIM x DIM ne moramo proveravati null
for (int i = 0; i < DIM; i++) {
for (int j = 0; j < DIM; j++) {
if (o2.tabla[i][j] != tabla[i][j]) {