package abstractFactory;
public abstract class Bus extends Car {
private int passengerNum;
private boolean twoStage;
int doorNum, int wheelNum,
int seetNum, int maxSpeed,
int passengerNum, boolean twoStage) {
super(number, doorNum, wheelNum, seetNum, maxSpeed);
this.passengerNum = passengerNum;
this.twoStage = twoStage;
}
public int getPassengerNum() {
return passengerNum;
}
public void setPassengerNum(int passengerNum) {
this.passengerNum = passengerNum;
}
public boolean isTwoStage() {
return twoStage;
}
public void setTwoStage(boolean twoStage) {
this.twoStage = twoStage;
}
// equals/hashCode/toString >>
public boolean equals
(Object o
) { if (!(o instanceof Car)) {
return false;
}
if (!(o instanceof Bus)) {
return o.equals(this);
}
Bus other = (Bus) o;
return (super.equals(o) &&
other.twoStage == twoStage &&
other.passengerNum == passengerNum);
}
public int hashCode() {
int res = super.hashCode();
res = 37 * res + (twoStage ? 1 : 0);
res = 37 * res + passengerNum;
return res;
}
String res =
super.
toString();
res += ", twoStage=" + twoStage;
res += ", passengerNum=" + passengerNum;
return res;
}
}