Финал
This commit is contained in:
parent
41bc1ec037
commit
8737449c24
@ -6,16 +6,11 @@ public enum CountWheels{
|
|||||||
private CountWheels(int val){
|
private CountWheels(int val){
|
||||||
this.val = val;
|
this.val = val;
|
||||||
}
|
}
|
||||||
private int countWheels;
|
|
||||||
public int getCountWheels(){
|
public int getCountWheels(){
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
public void setCountWheels(int countWheels){
|
|
||||||
this.countWheels = countWheels;
|
|
||||||
}
|
|
||||||
public void setEnumValue(){
|
|
||||||
CountWheels enumvalue = CountWheels.values()[countWheels];
|
|
||||||
}
|
|
||||||
public static CountWheels fromNumberToEnum(int number) {
|
public static CountWheels fromNumberToEnum(int number) {
|
||||||
try{
|
try{
|
||||||
for (CountWheels countWheels : CountWheels.values()) {
|
for (CountWheels countWheels : CountWheels.values()) {
|
||||||
|
@ -7,12 +7,21 @@ public class DrawingWheels{
|
|||||||
Color color;
|
Color color;
|
||||||
private CountWheels _countWheels;
|
private CountWheels _countWheels;
|
||||||
|
|
||||||
|
public void setNumWheels(int numRollers) {
|
||||||
|
if (numRollers < 4 || numRollers > 6 ){
|
||||||
|
|
||||||
|
_countWheels = CountWheels.fromNumberToEnum(numRollers);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_countWheels = CountWheels.fromNumberToEnum(numRollers);
|
||||||
|
}
|
||||||
|
|
||||||
public DrawingWheels(Graphics g, int startPosX, int startPosY, Color color, int countWheels){
|
public DrawingWheels(Graphics g, int startPosX, int startPosY, Color color, int countWheels){
|
||||||
this.g = g;
|
this.g = g;
|
||||||
_startPosX = startPosX;
|
_startPosX = startPosX;
|
||||||
_startPosY = startPosY;
|
_startPosY = startPosY;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
_countWheels.setCountWheels(countWheels);
|
setNumWheels(countWheels);
|
||||||
}
|
}
|
||||||
public void Draw(){
|
public void Draw(){
|
||||||
switch(_countWheels){
|
switch(_countWheels){
|
||||||
|
Loading…
Reference in New Issue
Block a user