Avancement sur l'implémentation des méthodes des interfaces. Penser à

continuer l'idée du neighbourList
This commit is contained in:
antograb committed 2017-11-16 09:58:44 +01:00
1 parent f7646c48f6
commit 36dd8ff805
3 files changed
+17 -7

No files matched your search

+5
View File
@@ -1,3 +1,4 @@
import java.util.List;
public abstract class Box
implements VertexInterface {
@@ -6,12 +7,16 @@ public abstract class Box
private int y ;
private String label ;
private Maze maze ;
private List<Box> neighbourList ;
public Box (String label, int x, int y, Maze maze) {
this.label = label ;
this.x = x ;
this.y = y ;
this.maze = maze ;
if (x != 0 && y != 0 && x != maze.getDimensionX() && y != maze.getDimensionY()) {
this.neighbourList.add(maze.getMaze()[x+1][y]) ;
}
}
public boolean compareTo(VertexInterface vertex) {
+1
View File
@@ -5,6 +5,7 @@ public class EBox extends Box{
super(label,x,y,maze) ;
}
}
+11 -7
View File
@@ -1,3 +1,5 @@
import java.util.Iterator;
import java.util.List;
public class Maze
implements GraphInterface{
@@ -5,18 +7,20 @@ public class Maze
int dimensionX ;
int dimensionY ;
int[][] maze ;
int[][] adjMatrix ;
public Maze(int dimensionX, int dimensionY, int[][] adjmatrix) {
public Maze(int dimensionX, int dimensionY, int[][] maze) {
this.dimensionX = dimensionX ;
this.dimensionY = dimensionY ;
this.maze = new int[dimensionX][dimensionY] ;
this.adjMatrix = adjMatrix ;
this.maze = maze ;
this.dimensionX = maze.length ;
this.dimensionY = maze[0].length ;
}
public int getCost(VertexInterface start, VertexInterface end) {
public int getCost(Box start, Box end) {
}
public int getVertexNumber() {
}