package abstractFactory.rusFleet;
import abstractFactory.Car;
public class Vaz2110
extends Car
implements Cloneable { private final String factoryId;
private boolean injector;
public Vaz2110
(String number,
final int modelNum,
boolean injector) {
super(number, 4, 4, 5, 180);
this.
factoryId =
"21" +
String.
valueOf(modelNum
);
this.injector = injector;
}
public String getFactoryId
() { return factoryId;
}
public boolean isInjector() {
return injector;
}
// equals/hashCode/toString >>
public boolean equals
(Object o
) { if (!(o instanceof Car)) {
return false;
}
if (!(o instanceof Vaz2110)) {
return o.equals(this);
}
Vaz2110 other = (Vaz2110) o;
return (super.equals(o) &&
other.injector == injector &&
other.factoryId == factoryId);
}
public int hashCode() {
int res = super.hashCode();
res = res * 37 + (injector ? 1 : 0);
res = res * 37 + factoryId.hashCode();
return res;
}
String res =
super.
toString();
res += ", injector=" + injector;
res += ", factoryId=" + factoryId;
return res;
}
}