Simplified if statements and restricted var access where applicable
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
parent
ce68e751fc
commit
6b796d80c1
|
@ -53,7 +53,7 @@ public class Haus extends Immobilie {
|
|||
|
||||
Haus other = (Haus)obj;
|
||||
|
||||
if(other.getId() != getId() ||
|
||||
return !(other.getId() != getId() ||
|
||||
other.getPlz() != getPlz() ||
|
||||
other.getFlaeche() != getFlaeche() ||
|
||||
!Helper.compareObjects(this.getOrt(), other.getOrt()) ||
|
||||
|
@ -61,11 +61,6 @@ public class Haus extends Immobilie {
|
|||
!Helper.compareObjects(this.getHausnummer(), other.getHausnummer()) ||
|
||||
getStockwerke() != other.getStockwerke() ||
|
||||
getKaufpreis() != other.getKaufpreis() ||
|
||||
isGarten() != other.isGarten())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
isGarten() != other.isGarten());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public abstract class Immobilie {
|
|||
private String hausnummer;
|
||||
private int flaeche;
|
||||
private Makler verwalter;
|
||||
static int currentId = 0;
|
||||
private static int currentId = 0;
|
||||
|
||||
public Immobilie() {
|
||||
this.id = currentId++;
|
||||
|
@ -84,16 +84,11 @@ public abstract class Immobilie {
|
|||
|
||||
Immobilie other = (Immobilie)obj;
|
||||
|
||||
if(other.getId() != getId() ||
|
||||
return !(other.getId() != getId() ||
|
||||
other.getPlz() != getPlz() ||
|
||||
other.getFlaeche() != getFlaeche() ||
|
||||
!Helper.compareObjects(this.getOrt(), other.getOrt()) ||
|
||||
!Helper.compareObjects(this.getStrasse(), other.getStrasse()) ||
|
||||
!Helper.compareObjects(this.getHausnummer(), other.getHausnummer()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
!Helper.compareObjects(this.getHausnummer(), other.getHausnummer()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,15 +54,10 @@ public class Kaufvertrag extends Vertrag {
|
|||
|
||||
Kaufvertrag other = (Kaufvertrag)obj;
|
||||
|
||||
if(other.getVertragsnummer() != getVertragsnummer() ||
|
||||
return !(other.getVertragsnummer() != getVertragsnummer() ||
|
||||
!Helper.compareObjects(this.getDatum(), other.getDatum()) ||
|
||||
!Helper.compareObjects(this.getOrt(), other.getOrt()) ||
|
||||
other.getAnzahlRaten() != getAnzahlRaten() ||
|
||||
other.getRatenzins() != getRatenzins())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
other.getRatenzins() != getRatenzins());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,15 +88,10 @@ public class Makler {
|
|||
|
||||
Makler other = (Makler)obj;
|
||||
|
||||
if(other.getId() != getId() ||
|
||||
return !(other.getId() != getId() ||
|
||||
!Helper.compareObjects(getName(), other.getName()) ||
|
||||
!Helper.compareObjects(getAdresse(), other.getAdresse()) ||
|
||||
!Helper.compareObjects(getLogin(), other.getLogin()) ||
|
||||
!Helper.compareObjects(getPasswort(), other.getPasswort()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
!Helper.compareObjects(getPasswort(), other.getPasswort()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,16 +64,11 @@ public class Mietvertrag extends Vertrag {
|
|||
|
||||
Mietvertrag other = (Mietvertrag)obj;
|
||||
|
||||
if(other.getVertragsnummer() != getVertragsnummer() ||
|
||||
return !(other.getVertragsnummer() != getVertragsnummer() ||
|
||||
!Helper.compareObjects(this.getDatum(), other.getDatum()) ||
|
||||
!Helper.compareObjects(this.getOrt(), other.getOrt()) ||
|
||||
other.getDauer() != getDauer() ||
|
||||
other.getNebenkosten() != getNebenkosten() ||
|
||||
!Helper.compareObjects(other.getMietbeginn(), getMietbeginn()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
!Helper.compareObjects(other.getMietbeginn(), getMietbeginn()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,14 +59,9 @@ public class Person {
|
|||
|
||||
Person other = (Person)obj;
|
||||
|
||||
if(other.getId() != getId() ||
|
||||
return !(other.getId() != getId() ||
|
||||
!Helper.compareObjects(this.getVorname(), other.getVorname()) ||
|
||||
!Helper.compareObjects(this.getNachname(), other.getNachname()) ||
|
||||
!Helper.compareObjects(this.getAdresse(), other.getAdresse()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
!Helper.compareObjects(this.getAdresse(), other.getAdresse()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,9 +11,9 @@ public abstract class Vertrag {
|
|||
private int vertragsnummer = -1;
|
||||
private Date datum;
|
||||
private String ort;
|
||||
static int currentId = 0;
|
||||
int id;
|
||||
Person vertragspartner;
|
||||
private static int currentId = 0;
|
||||
private int id;
|
||||
private Person vertragspartner;
|
||||
|
||||
public Vertrag() {
|
||||
this.id = currentId++;
|
||||
|
@ -73,13 +73,8 @@ public abstract class Vertrag {
|
|||
|
||||
Vertrag other = (Vertrag)obj;
|
||||
|
||||
if(other.getVertragsnummer() != getVertragsnummer() ||
|
||||
return !(other.getVertragsnummer() != getVertragsnummer() ||
|
||||
!Helper.compareObjects(this.getDatum(), other.getDatum()) ||
|
||||
!Helper.compareObjects(this.getOrt(), other.getOrt()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
!Helper.compareObjects(this.getOrt(), other.getOrt()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ public class Wohnung extends Immobilie {
|
|||
|
||||
Wohnung other = (Wohnung)obj;
|
||||
|
||||
if(other.getId() != getId() ||
|
||||
return !(other.getId() != getId() ||
|
||||
other.getPlz() != getPlz() ||
|
||||
other.getFlaeche() != getFlaeche() ||
|
||||
!Helper.compareObjects(this.getOrt(), other.getOrt()) ||
|
||||
|
@ -80,11 +80,6 @@ public class Wohnung extends Immobilie {
|
|||
getMietpreis() != other.getMietpreis() ||
|
||||
getZimmer() != other.getZimmer() ||
|
||||
isBalkon() != other.isBalkon() ||
|
||||
isEbk() != other.isEbk())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
isEbk() != other.isEbk());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue