-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCase.java
executable file
·79 lines (69 loc) · 1.25 KB
/
Case.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/**
*
*/
/**
* @author Pierrick
*
*/
public class Case {
/**
*
**/
int x, y;
Piece piece;
Damier damier ;
public Case() {
this.x = 0 ;
this.y = 0 ;
this.piece=new Piece();
}
public Case(int x, int y, Damier damier) {
this.x = x ;
this.y = y ;
this.piece = new Piece();
this.damier = damier ;
}
//get et set
public int getX(){
return this.x ;
}
public int getY(){
return this.y ;
}
public Piece getPiece(){
return this.piece ;
}
public Damier getDamier(){
return this.damier ;
}
public void setX(int x){
this.x = x ;
}
public void setY(int y){
this.y = y ;
}
public void setPiece(Piece piece){
this.piece = piece ;
}
public void setDamier(Damier damier){
this.damier=damier ;
}
//copie
public Case copieCase(){
Case nouvelleCase = new Case() ;
nouvelleCase.setX(this.getX());
nouvelleCase.setY(this.getY());
nouvelleCase.setPiece(this.getPiece().copiePiece());
return nouvelleCase ;
}
//equal
public boolean equal(Case yop){
if(yop==null){
return false;
}
if(this.getX()==yop.getX() && this.getY()==yop.getY() && this.getPiece().equal(yop.getPiece())){
return true;
}
return false;
}
}