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