Avancement sur le tp. Implémentation (pas finie) des interfaces pour le

maze et Box.
This commit is contained in:
antograb committed 2017-11-09 10:00:05 +01:00
1 parent 0f7ef69441
commit f7646c48f6
8 files changed
+75 -16

No files matched your search

+2 -2
View File
@@ -1,9 +1,9 @@
public class ABox extends Box{
public ABox (int x, int y) {
public ABox (String label, int x, int y, Maze maze) {
super(x,y) ;
super(label,x,y,maze) ;
}
}
+32 -4
View File
@@ -1,14 +1,24 @@
public abstract class Box {
public abstract class Box
implements VertexInterface {
private int x ;
private int y ;
private String label ;
private Maze maze ;
public Box (int x, int y) {
public Box (String label, int x, int y, Maze maze) {
this.label = label ;
this.x = x ;
this.y = y ;
this.maze = maze ;
}
public boolean compareTo(VertexInterface vertex) {
if (this.getLabel() == vertex.getLabel()) {
return true ;
}
return false ;
}
public int getX() {
@@ -26,5 +36,23 @@ public abstract class Box {
public void setY(int y) {
this.y = y;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Maze getMaze() {
return maze;
}
public void setMaze(Maze maze) {
this.maze = maze;
}
}
+2 -2
View File
@@ -1,9 +1,9 @@
public class DBox extends Box{
public DBox (int x, int y) {
public DBox (String label, int x, int y, Maze maze) {
super(x,y) ;
super(label,x,y,maze) ;
}
+2 -2
View File
@@ -1,9 +1,9 @@
public class EBox extends Box{
public EBox (int x, int y) {
public EBox (String label, int x, int y, Maze maze) {
super(x,y) ;
super(label,x,y,maze) ;
}
+14
View File
@@ -0,0 +1,14 @@
import java.util.ArrayList;
public interface GraphInterface {
/** Returns the number of Vertexes */
public int getVertexNumber() ;
/** Return the cost between two vertexes */
public int getCost(VertexInterface start, VertexInterface end) ;
/** Returns an list of Vertexes */
public ArrayList<VertexInterface> getVertexes() ;
}
+12 -4
View File
@@ -1,15 +1,22 @@
public class Maze {
public class Maze
implements GraphInterface{
int dimensionX ;
int dimensionY ;
int[][] maze ;
int[][] adjMatrix ;
public Maze(int x, int y) {
public Maze(int dimensionX, int dimensionY, int[][] adjmatrix) {
this.dimensionX = x ;
this.dimensionY = y ;
this.dimensionX = dimensionX ;
this.dimensionY = dimensionY ;
this.maze = new int[dimensionX][dimensionY] ;
this.adjMatrix = adjMatrix ;
}
public int getCost(VertexInterface start, VertexInterface end) {
}
@@ -39,4 +46,5 @@ public class Maze {
}
+9
View File
@@ -0,0 +1,9 @@
public interface VertexInterface {
/** Compare a Vertex to another */
public boolean compareTo(VertexInterface vertex) ;
public String getLabel() ;
}
+2 -2
View File
@@ -1,9 +1,9 @@
public class WBox extends Box {
public WBox (int x, int y) {
public WBox (String label, int x, int y, Maze maze) {
super(x,y) ;
super(label,x,y,maze) ;
}