Refactor CalcolaSecondaTerna
This commit is contained in:
parent
a42d4d9a61
commit
756392308d
@ -185,23 +185,8 @@ public class GestisciCodiceFiscale {
|
|||||||
int posizionePrimaVocale = trovaPrimaVocale(caratteriNome)[1];
|
int posizionePrimaVocale = trovaPrimaVocale(caratteriNome)[1];
|
||||||
|
|
||||||
if (posizioniConsonanti[1] == -1) { // non c'è la seconda consonante
|
if (posizioniConsonanti[1] == -1) { // non c'è la seconda consonante
|
||||||
int secondaVocale = trovaSecondaVocale(caratteriNome, posizionePrimaVocale);
|
ritorno = quartoQuintoSestoCasoNome(caratteriNome, primaVocale, posizionePrimaVocale,
|
||||||
|
posizioniConsonanti[0]);
|
||||||
if (secondaVocale == -1) { // non c'è la seconda vocale
|
|
||||||
ritorno = Character.toString(caratteriNome[posizioniConsonanti[0]])
|
|
||||||
+ Character.toString(primaVocale)
|
|
||||||
+ Character.toString('x');
|
|
||||||
} else {
|
|
||||||
if (posizioniConsonanti[0] == -1) {
|
|
||||||
ritorno = Character.toString(primaVocale)
|
|
||||||
+ Character.toString(secondaVocale)
|
|
||||||
+ Character.toString('x');
|
|
||||||
} else {
|
|
||||||
ritorno = Character.toString(caratteriNome[posizioniConsonanti[0]])
|
|
||||||
+ Character.toString(primaVocale)
|
|
||||||
+ Character.toString(secondaVocale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ritorno = Character.toString(caratteriNome[posizioniConsonanti[0]])
|
ritorno = Character.toString(caratteriNome[posizioniConsonanti[0]])
|
||||||
+ Character.toString(caratteriNome[posizioniConsonanti[1]])
|
+ Character.toString(caratteriNome[posizioniConsonanti[1]])
|
||||||
@ -221,6 +206,28 @@ public class GestisciCodiceFiscale {
|
|||||||
return ritorno;
|
return ritorno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String quartoQuintoSestoCasoNome(char[] caratteriNome, char primaVocale, int posizionePrimaVocale, int primaConsonante) {
|
||||||
|
String ritorno;
|
||||||
|
int secondaVocale = trovaSecondaVocale(caratteriNome, posizionePrimaVocale);
|
||||||
|
|
||||||
|
if (secondaVocale == -1) { // non c'è la seconda vocale
|
||||||
|
ritorno = Character.toString(caratteriNome[primaConsonante])
|
||||||
|
+ Character.toString(primaVocale)
|
||||||
|
+ Character.toString('x');
|
||||||
|
} else {
|
||||||
|
if (primaConsonante == -1) {
|
||||||
|
ritorno = Character.toString(primaVocale)
|
||||||
|
+ Character.toString(secondaVocale)
|
||||||
|
+ Character.toString('x');
|
||||||
|
} else {
|
||||||
|
ritorno = Character.toString(caratteriNome[primaConsonante])
|
||||||
|
+ Character.toString(primaVocale)
|
||||||
|
+ Character.toString(secondaVocale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ritorno;
|
||||||
|
}
|
||||||
|
|
||||||
static String CalcolaSettimoOttavo(Date dataNascita) {
|
static String CalcolaSettimoOttavo(Date dataNascita) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user