identação resolvida!
This commit is contained in:
parent
6a013de291
commit
74a0c6b88c
|
|
@ -1,7 +1,8 @@
|
||||||
class Hash {
|
|
||||||
|
public class Hash {
|
||||||
int tabela[];
|
int tabela[];
|
||||||
int m;
|
int m;
|
||||||
int NULO = -1;
|
final int NULO = -1;
|
||||||
|
|
||||||
public Hash() {
|
public Hash() {
|
||||||
this(13);
|
this(13);
|
||||||
|
|
@ -25,40 +26,29 @@ class Hash {
|
||||||
|
|
||||||
public boolean inserir(int elemento) {
|
public boolean inserir(int elemento) {
|
||||||
boolean resp = false;
|
boolean resp = false;
|
||||||
|
|
||||||
if (elemento != NULO) {
|
if (elemento != NULO) {
|
||||||
|
|
||||||
int pos = h(elemento);
|
int pos = h(elemento);
|
||||||
|
|
||||||
if (tabela[pos] == NULO) {
|
if (tabela[pos] == NULO) {
|
||||||
tabela[pos] = elemento;
|
tabela[pos] = elemento;
|
||||||
resp = true;
|
resp = true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
pos = reh(elemento);
|
pos = reh(elemento);
|
||||||
|
|
||||||
if (tabela[pos] == NULO) {
|
if (tabela[pos] == NULO) {
|
||||||
tabela[pos] = elemento;
|
tabela[pos] = elemento;
|
||||||
resp = true;
|
resp = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean pesquisar(int elemento) {
|
public boolean pesquisar(int elemento) {
|
||||||
boolean resp = false;
|
boolean resp = false;
|
||||||
|
|
||||||
int pos = h(elemento);
|
int pos = h(elemento);
|
||||||
|
|
||||||
if (tabela[pos] == elemento) {
|
if (tabela[pos] == elemento) {
|
||||||
resp = true;
|
resp = true;
|
||||||
|
} else if (tabela[pos] != NULO) {
|
||||||
} else {
|
|
||||||
pos = reh(elemento);
|
pos = reh(elemento);
|
||||||
|
|
||||||
if (tabela[pos] == elemento) {
|
if (tabela[pos] == elemento) {
|
||||||
resp = true;
|
resp = true;
|
||||||
}
|
}
|
||||||
|
|
@ -68,9 +58,7 @@ class Hash {
|
||||||
|
|
||||||
boolean remover(int elemento) {
|
boolean remover(int elemento) {
|
||||||
boolean resp = false;
|
boolean resp = false;
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
|
|
||||||
public class Hash {
|
public class Hash {
|
||||||
int tabela[];
|
int tabela[];
|
||||||
int m1, m2, m, reserva;
|
int m1, m2, m, reserva;
|
||||||
int NULO = -1;
|
final int NULO = -1;
|
||||||
|
|
||||||
public Hash() {
|
public Hash() {
|
||||||
this(13, 7);
|
this(13, 7);
|
||||||
|
|
@ -24,35 +25,26 @@ public class Hash {
|
||||||
|
|
||||||
public boolean inserir(int elemento) {
|
public boolean inserir(int elemento) {
|
||||||
boolean resp = false;
|
boolean resp = false;
|
||||||
|
|
||||||
if (elemento != NULO) {
|
if (elemento != NULO) {
|
||||||
|
|
||||||
int pos = h(elemento);
|
int pos = h(elemento);
|
||||||
|
|
||||||
if (tabela[pos] == NULO) {
|
if (tabela[pos] == NULO) {
|
||||||
tabela[pos] = elemento;
|
tabela[pos] = elemento;
|
||||||
resp = true;
|
resp = true;
|
||||||
|
|
||||||
} else if (reserva < m2) {
|
} else if (reserva < m2) {
|
||||||
tabela[m1 + reserva] = elemento;
|
tabela[m1 + reserva] = elemento;
|
||||||
reserva++;
|
reserva++;
|
||||||
resp = true;
|
resp = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean pesquisar(int elemento) {
|
public boolean pesquisar(int elemento) {
|
||||||
boolean resp = false;
|
boolean resp = false;
|
||||||
|
|
||||||
int pos = h(elemento);
|
int pos = h(elemento);
|
||||||
|
|
||||||
if (tabela[pos] == elemento) {
|
if (tabela[pos] == elemento) {
|
||||||
resp = true;
|
resp = true;
|
||||||
|
} else if (tabela[pos] != NULO) {
|
||||||
} else {
|
|
||||||
for (int i = 0; i < reserva; i++) {
|
for (int i = 0; i < reserva; i++) {
|
||||||
if (tabela[m1 + i] == elemento) {
|
if (tabela[m1 + i] == elemento) {
|
||||||
resp = true;
|
resp = true;
|
||||||
|
|
@ -65,9 +57,7 @@ public class Hash {
|
||||||
|
|
||||||
boolean remover(int elemento) {
|
boolean remover(int elemento) {
|
||||||
boolean resp = false;
|
boolean resp = false;
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ class HashIndiretoLista {
|
||||||
int pos = h(elemento);
|
int pos = h(elemento);
|
||||||
tabela[pos].inserirInicio(elemento);
|
tabela[pos].inserirInicio(elemento);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
void remover(int elemento){
|
public int remover(int elemento) {
|
||||||
int resp = NULO;
|
int resp = NULO;
|
||||||
if (pesquisar(elemento) == false) {
|
if (pesquisar(elemento) == false) {
|
||||||
throw new Exception("Erro ao remover!");
|
throw new Exception("Erro ao remover!");
|
||||||
|
|
@ -39,5 +39,4 @@ class HashIndiretoLista {
|
||||||
}
|
}
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -166,6 +166,7 @@ class Serie {
|
||||||
//System.out.println(resp);
|
//System.out.println(resp);
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
//método para tratar o nome do arquivo e retornar o nome da série
|
//método para tratar o nome do arquivo e retornar o nome da série
|
||||||
public String searchName(String fileName){
|
public String searchName(String fileName){
|
||||||
String resp = "";
|
String resp = "";
|
||||||
|
|
@ -178,6 +179,7 @@ class Serie {
|
||||||
}
|
}
|
||||||
return resp.substring(0, resp.length()-5); //retorno da substring resp retirando os 5 últimos caracteres relacionados à extensão do arquivo
|
return resp.substring(0, resp.length()-5); //retorno da substring resp retirando os 5 últimos caracteres relacionados à extensão do arquivo
|
||||||
}
|
}
|
||||||
|
|
||||||
//método para leitura do arquivo .html e tratamento das linhas
|
//método para leitura do arquivo .html e tratamento das linhas
|
||||||
public void readClass(String fileName){
|
public void readClass(String fileName){
|
||||||
String line;
|
String line;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue