Avancement sur l'implémentation des méthodes des interfaces. Penser à
continuer l'idée du neighbourList
This commit is contained in:
1 parent
f7646c48f6
commit
36dd8ff805
3 files changed
+17
-7
No files matched your search
@@ -1,3 +1,4 @@
|
|||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class Box
|
public abstract class Box
|
||||||
implements VertexInterface {
|
implements VertexInterface {
|
||||||
@@ -6,12 +7,16 @@ public abstract class Box
|
|||||||
private int y ;
|
private int y ;
|
||||||
private String label ;
|
private String label ;
|
||||||
private Maze maze ;
|
private Maze maze ;
|
||||||
|
private List<Box> neighbourList ;
|
||||||
|
|
||||||
public Box (String label, int x, int y, Maze maze) {
|
public Box (String label, int x, int y, Maze maze) {
|
||||||
this.label = label ;
|
this.label = label ;
|
||||||
this.x = x ;
|
this.x = x ;
|
||||||
this.y = y ;
|
this.y = y ;
|
||||||
this.maze = maze ;
|
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) {
|
public boolean compareTo(VertexInterface vertex) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ public class EBox extends Box{
|
|||||||
|
|
||||||
super(label,x,y,maze) ;
|
super(label,x,y,maze) ;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Maze
|
public class Maze
|
||||||
implements GraphInterface{
|
implements GraphInterface{
|
||||||
@@ -5,18 +7,20 @@ public class Maze
|
|||||||
int dimensionX ;
|
int dimensionX ;
|
||||||
int dimensionY ;
|
int dimensionY ;
|
||||||
int[][] maze ;
|
int[][] maze ;
|
||||||
int[][] adjMatrix ;
|
|
||||||
|
|
||||||
public Maze(int dimensionX, int dimensionY, int[][] adjmatrix) {
|
public Maze(int dimensionX, int dimensionY, int[][] maze) {
|
||||||
|
|
||||||
this.dimensionX = dimensionX ;
|
this.maze = maze ;
|
||||||
this.dimensionY = dimensionY ;
|
this.dimensionX = maze.length ;
|
||||||
this.maze = new int[dimensionX][dimensionY] ;
|
this.dimensionY = maze[0].length ;
|
||||||
this.adjMatrix = adjMatrix ;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCost(VertexInterface start, VertexInterface end) {
|
public int getCost(Box start, Box end) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVertexNumber() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user