Boa noite, alguem pode me dizer qual o erro de sintaxe do código abaixo?
Os erros que aparecem são:
Syntax error on token “getNeighbors”, = expected after this token
- Syntax error on token(s), misplaced construct(s)
- Syntax error, insert “;” to complete Statement
- The method getNeighbors() is undefined for the type HeuristicService
- Syntax error, insert “;” to complete LocalVariableDeclarationStatement
- Syntax error, insert “VariableDeclarators” to complete
Estou tentando contruir um Dijkstra para uma Matriz.
public Set<int[]> getNeighbors(Set<int[]> ){
Set<int[]> neighbors = new HashSet<>();
int[] n = new int[2];
//n[0] = closest [0];
//n[1] = closest [1];
// analisa CIMA
if ((n[0] - 1) >= 0 && (n[0] - 1) < M) {
int[] c = new int[2];
c[0] = n[0] - 1;
c[1] = n[1];
neighbors.add(c);
}
// analisa ESQUERDA
if ((n[1] - 1) >= 0 && (n[1] - 1) < N) {
int[] e = new int[2];
e[0] = n[0];
e[1] = n[1] - 1;
neighbors.add(e);
}
// analisa DIREITA
if ((n[1] + 1) < N) {
int[] d = new int[2];
d[0] = n[0];
d[1] = n[1] - 1;
neighbors.add(d);
}
// analisa BAIXO
if ((n[0] + 1) < M) {
int[] b = new int[2];
b[0] = n[0];
b[1] = n[1] - 1;
neighbors.add(b);
}
return neighbors;
}