You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.6 KiB
64 lines
1.6 KiB
package com.car.model;
|
|
|
|
/**
|
|
* 活塞类 - 引擎的组件
|
|
* 与Engine类是组合关系
|
|
*/
|
|
public class Piston {
|
|
private int diameter; // 直径
|
|
private int stroke; // 冲程
|
|
private String material; // 材质
|
|
private int compressionRatio; // 压缩比
|
|
|
|
/**
|
|
* 构造方法
|
|
* @param diameter 活塞直径
|
|
* @param stroke 活塞冲程
|
|
* @param material 材质
|
|
* @param compressionRatio 压缩比
|
|
*/
|
|
public Piston(int diameter, int stroke, String material, int compressionRatio) {
|
|
this.diameter = diameter;
|
|
this.stroke = stroke;
|
|
this.material = material;
|
|
this.compressionRatio = compressionRatio;
|
|
}
|
|
|
|
// getter and setter methods
|
|
public int getDiameter() {
|
|
return diameter;
|
|
}
|
|
|
|
public void setDiameter(int diameter) {
|
|
this.diameter = diameter;
|
|
}
|
|
|
|
public int getStroke() {
|
|
return stroke;
|
|
}
|
|
|
|
public void setStroke(int stroke) {
|
|
this.stroke = stroke;
|
|
}
|
|
|
|
public String getMaterial() {
|
|
return material;
|
|
}
|
|
|
|
public void setMaterial(String material) {
|
|
this.material = material;
|
|
}
|
|
|
|
public int getCompressionRatio() {
|
|
return compressionRatio;
|
|
}
|
|
|
|
public void setCompressionRatio(int compressionRatio) {
|
|
this.compressionRatio = compressionRatio;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "Piston [diameter=" + diameter + ", stroke=" + stroke + ", material=" + material + ", compressionRatio=" + compressionRatio + "]";
|
|
}
|
|
} |