This commit is contained in:
yann 2021-02-01 01:32:13 +01:00
parent 2e227442e4
commit 6ef0b64e97

View file

@ -8,7 +8,7 @@ import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
/** /**
* Classe permettant de renvoyer les statistiques * Classe permettant de renvoyer les statistiques a partir de la DB
*/ */
public class Statistics { public class Statistics {
public DataBase maDB; public DataBase maDB;
@ -57,8 +57,9 @@ public class Statistics {
/** /**
* Methode renvoyant les numeros avec leur frequence d'apparition * Methode renvoyant les numeros avec leur frequence d'apparition
* @throws SQLException *
* @return affichage numeros * @return affichage numeros
* @throws SQLException
*/ */
public String numero1() throws SQLException { public String numero1() throws SQLException {
System.out.println("debut numero1"); System.out.println("debut numero1");
@ -114,7 +115,9 @@ public class Statistics {
//rs.next(); //rs.next();
while (rs.next()) { while (rs.next()) {
//System.out.println(numprec+", "+rs.getInt(2)); //System.out.println(numprec+", "+rs.getInt(2));
if(numprec!=rs.getInt(2)) {k = 0;} if (numprec != rs.getInt(2)) {
k = 0;
}
while (numId[rs.getInt(2)][k] != 0) { while (numId[rs.getInt(2)][k] != 0) {
k++; k++;
} }
@ -139,9 +142,10 @@ public class Statistics {
/** /**
* Methode renvoyant les combinaisons a deux numeros en fonction du premier numero choisi * Methode renvoyant les combinaisons a deux numeros en fonction du premier numero choisi
*
* @param chiffre1 premiere combinaison * @param chiffre1 premiere combinaison
* @throws SQLException
* @return affichage combinaison * @return affichage combinaison
* @throws SQLException
*/ */
public String combinaison2(int chiffre1) throws SQLException { public String combinaison2(int chiffre1) throws SQLException {
numero1(); numero1();
@ -183,10 +187,11 @@ public class Statistics {
/** /**
* Methode renvoyant les combinaisons a trois numeros en fonction des deux numeros choisi * Methode renvoyant les combinaisons a trois numeros en fonction des deux numeros choisi
*
* @param chiffre1 * @param chiffre1
* @param chiffre2 * @param chiffre2
* @throws SQLException
* @return affichage combinaison * @return affichage combinaison
* @throws SQLException
*/ */
public String combinaison3(int chiffre1, int chiffre2) throws SQLException { public String combinaison3(int chiffre1, int chiffre2) throws SQLException {
numero1(); numero1();
@ -230,8 +235,9 @@ public class Statistics {
/** /**
* Methode renvoyant les numeros bonus avec leur frequence d'apparition * Methode renvoyant les numeros bonus avec leur frequence d'apparition
* @throws SQLException *
* @return affichage numero bonus * @return affichage numero bonus
* @throws SQLException
*/ */
public String bonus() throws SQLException { public String bonus() throws SQLException {
System.out.println("debut bonus"); System.out.println("debut bonus");
@ -278,7 +284,9 @@ public class Statistics {
//rs.next(); //rs.next();
while (rs.next()) { while (rs.next()) {
//System.out.println(numprec+", "+rs.getInt(2)); //System.out.println(numprec+", "+rs.getInt(2));
if(numprec!=rs.getInt(2)) {k = 0;} if (numprec != rs.getInt(2)) {
k = 0;
}
while (bonusId[rs.getInt(2)][k] != 0) { while (bonusId[rs.getInt(2)][k] != 0) {
k++; k++;
} }
@ -300,145 +308,5 @@ public class Statistics {
} }
return s; return s;
} }
/**
* Methode renvoyant les numeros bonus en fonction des combinaisons a un numeros
* @param chiffre1
* @throws SQLException
* @return affchage combinaison a un element et numero bonus
*/
public String bonusCombi1(int chiffre1) throws SQLException {
numero1();
this.bonus();
System.out.println("debut bonus");
numSelect[1]=chiffre1;
int j=0, k=0, l=0, cpt=0;
for(int i=1;i<11;i++) {
while (numId[chiffre1][j] != 0) {
while (bonusId[i][k] != 0) {
//System.out.println(bonusId[i][k] +"=="+ numId[chiffre1][j]);
if (bonusId[i][k] == numId[chiffre1][j]) {
num1_bonusCpt[i]++;
num1_bonusId[i][cpt++]=bonusId[i][k];
j++;
}
k++;
}
k = 0;
j++;
}
j = 0;
cpt=0;
}
String s = null;
for (int i=1; i<11;i++) {
/*for (int p=1; p<50;p++) {
System.out.print(combi1Id[i][p]+", ");
}*/
System.out.println(i+": "+num1_bonusCpt[i]);
while(num1_bonusId[i][l]!=0){
System.out.print(num1_bonusId[i][l]+", ");
l++;
}
System.out.println();
l=0;
}
return s;
} }
/**
* Methode renvoyant les numeros bonus en fonction des combinaisons a deux numeros
* @param chiffre1
* @param chiffre2
* @throws SQLException
* @return affchage combinaison a deux elements et numero bonus
*/
public String bonusCombi2(int chiffre1, int chiffre2) throws SQLException {
combinaison2(chiffre1);
bonus();
System.out.println("debut bonusCombi2");
numSelect[1]=chiffre1;
numSelect[2]=chiffre2;
int j=0, k=0, l=0, cpt=0;
for(int i=1;i<11;i++) {
while (combi1Id[chiffre2][j] != 0) {
while (bonusId[i][k] != 0) {
//System.out.println(bonusId[i][k] +"=="+ combi1Id[chiffre2][j]);
if (bonusId[i][k] == combi1Id[chiffre2][j]) {
num2_bonusCpt[i]++;
num2_bonusId[i][cpt++]=bonusId[i][k];
j++;
}
k++;
}
k = 0;
j++;
}
j = 0;
cpt=0;
}
String s = null;
for (int i=1; i<11;i++) {
/*for (int p=1; p<50;p++) {
System.out.print(combi1Id[i][p]+", ");
}*/
System.out.println(i+": "+num2_bonusCpt[i]);
while(num2_bonusId[i][l]!=0){
System.out.print(num2_bonusId[i][l]+", ");
l++;
}
System.out.println();
l=0;
}
return s;
}
/**
* Methode renvoyant les numeros bonus en fonction des combinaisons a trois numeros
* @param chiffre1
* @param chiffre2
* @param chiffre3
* @throws SQLException
* @return affchage combinaison a trois elements et numero bonus
*/
public String bonusCombi3(int chiffre1, int chiffre2, int chiffre3) throws SQLException {
combinaison3(chiffre1, chiffre2);
bonus();
System.out.println("debut bonusCombi3");
numSelect[1]=chiffre1;
numSelect[2]=chiffre2;
numSelect[3]=chiffre3;
int j=0, k=0, l=0, cpt=0;
while (combi2Id[chiffre3][j] != 0) {
for(int i=1;i<11;i++) {
while (bonusId[i][k] != 0) {
//System.out.println(combi2Id[chiffre3][j] +"=="+ bonusId[i][k]);
if (bonusId[i][k] == combi2Id[chiffre3][j]) {
num3_bonusCpt[i]++;
num3_bonusId[i][cpt++]=bonusId[i][k];
j++;
}
k++;
}
k = 0;
}
cpt=0;
j++;
}
for (int i=1; i<11;i++) {
/*for (int p=1; p<50;p++) {
System.out.print(combi1Id[i][p]+", ");
}*/
System.out.println(i+": "+num3_bonusCpt[i]);
while(num3_bonusId[i][l]!=0){
System.out.print(num3_bonusId[i][l]+", ");
l++;
}
System.out.println();
l=0;
}
String s = null;
return s;
}
}