fichier renamed
This commit is contained in:
parent
565d7bf6da
commit
f2824193af
5 changed files with 593 additions and 502 deletions
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1,474 +0,0 @@
|
|||
package fr.myny.stats;
|
||||
|
||||
import fr.myny.database.DataBase;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* La classe Choix qui sert a donner le nombre d'appartition de chaque chiffre/combinaison (et leurs ID si besoin)
|
||||
*/
|
||||
|
||||
|
||||
public class Choix {
|
||||
public DataBase maDB;
|
||||
public Connection conn;
|
||||
public long numSelect[];
|
||||
public int bonusSelect;
|
||||
public long numId[][]; //liste des identifiants des lignes contenant un chiffre specifique
|
||||
public long numCpt[][]; //total d'apparitions de chaque chiffre
|
||||
public long bonusId[][]; //liste des identifiants des lignes contenant un chiffre bonus specifique
|
||||
public long bonusCpt[][]; //total d'apparitions de chaque bonus
|
||||
public long combi1Id[][]; //liste des identifiants des lignes cumulant 2 chiffres specifiques
|
||||
public long combi1Cpt[]; //total d'apparitions de chaque chiffre qui correspond egalement a un premier chiffre sur la meme ligne
|
||||
public long combi2Id[][]; //liste des identifiants des lignes cumulant 3 chiffres specifiques
|
||||
public long combi2Cpt[]; //total d'apparitions de chaque chiffre qui correspond egalement aux 2 premiers chiffres sur la meme ligne
|
||||
public long num1_bonusId[][]; //liste des identifiants des lignes cumulant 1 chiffre specifique et un numero bonus specifique
|
||||
public long num1_bonusCpt[]; //total d'apparitions de chaque bonus qui correspond egalement au premier chiffre sur la meme ligne
|
||||
public long num2_bonusId[][]; //liste des identifiants des lignes cumulant 2 chiffres specifiques et un numero bonus specifique
|
||||
public long num2_bonusCpt[]; //total d'apparitions de chaque bonus qui correspond egalement aux 2 premiers chiffres sur la meme ligne
|
||||
public long num3_bonusId[][]; //liste des identifiants des lignes cumulant 3 chiffres specifiques et un numero bonus specifique
|
||||
public long num3_bonusCpt[]; //total d'apparitions de chaque bonus qui correspond egalement aux 3 premiers chiffres sur la meme ligne
|
||||
public long taille;
|
||||
|
||||
/**
|
||||
* Constructeur, charge d'initialiser les differents champs
|
||||
* <p>Pour les tableaux, leurs tailles (de 4000) sont surevaluees pour pouvoir augmenter quandla table augmentera</p>
|
||||
* <p>Une solution optimale serait de fonctionner par exmple avec des TreeMap ou des ArrayLists a la place, pour eviter</p>
|
||||
* <p>d'utiliser trop de memoire inutilement</p>
|
||||
*/
|
||||
public Choix(){
|
||||
maDB=new DataBase();
|
||||
conn= maDB.getConnection();
|
||||
numSelect =new long[5];
|
||||
numId =new long[50][4000];
|
||||
numCpt = new long[50][2];
|
||||
combi1Id =new long[50][4000];
|
||||
combi1Cpt = new long[50];
|
||||
num1_bonusId =new long[11][4000];
|
||||
num1_bonusCpt = new long[11];
|
||||
num2_bonusId =new long[11][4000];
|
||||
num2_bonusCpt = new long[11];
|
||||
num3_bonusId =new long[11][4000];
|
||||
num3_bonusCpt = new long[11];
|
||||
combi2Id=new long[50][4000];
|
||||
combi2Cpt=new long[50];
|
||||
bonusId =new long[11][4000];
|
||||
bonusCpt=new long[11][2];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sert a recuperer la taille de la table pour calculer la frequence d'apparition de la combinaison/du nombre considere
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void setTaille(){
|
||||
/*on effectue un requete "SELECT Count(*) From myny.Test_Table"
|
||||
puis on l'affecte a une variable de l'objet Choix*/
|
||||
try {
|
||||
conn = maDB.getConnection();
|
||||
if (conn != null) {
|
||||
Statement ps = conn.createStatement();
|
||||
ResultSet rs=ps.executeQuery("SELECT Count(*) From myny.Test_Table");
|
||||
rs.next();
|
||||
long nbcolret= rs.getLong(1);
|
||||
conn.commit();
|
||||
System.out.println("statement cree");
|
||||
taille =nbcolret;
|
||||
System.out.println(taille);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("chiffre1 probleme");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sert a recuperer le nombre d'apparitions de chaque numero ainsi que leurs id (annee_numero_de_tirage) de la table dans la db
|
||||
* <p>i, k, l (int) sont des compteurs</p>
|
||||
* <p>numprec(int) verifie si on change de chiffre ou non</p>
|
||||
* <p>rs (ResultSet) sert a avoir des retours sur les requetes realisees</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherChiffre1() throws SQLException {
|
||||
System.out.println("debut afficherChiffre1");
|
||||
int k=0, numprec=0, l=0;
|
||||
ResultSet rs=null;
|
||||
String sql;
|
||||
for (int i=1; i<6;i++) {
|
||||
//pour chaque colonne contenant une boule (non bonus) de la table, on va recuperer le nombre d'apparitions de chaque boule et le stocker dans un tableau
|
||||
sql = "SELECT Test_Table.boule_" + i + ",Count(*) as 'cnt' FROM myny.Test_Table GROUP BY Test_Table.boule_" + i + "; ";
|
||||
try {
|
||||
if(conn==null) {
|
||||
conn = maDB.getConnection();
|
||||
}
|
||||
if (conn != null) {
|
||||
Statement ps = conn.createStatement();
|
||||
rs = ps.executeQuery(sql);
|
||||
conn.commit();
|
||||
System.out.println("statement cree");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("chiffre1 probleme");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
while (rs.next()) {
|
||||
if (i == 1) {
|
||||
numCpt[rs.getInt(1)][0] = rs.getInt(1);
|
||||
numCpt[rs.getInt(1)][1] = rs.getLong(2);
|
||||
} else {
|
||||
numCpt[rs.getInt(1)][1] += rs.getLong(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=1; i<=5;i++) {
|
||||
//pour chaque colonne contenant une boule (non bonus) de la table, on va
|
||||
// recuperer les annee_numero_de_tirage correspondants et les stocker dans un tableau
|
||||
sql = "SELECT Test_Table.annee_numero_de_tirage, Test_Table.boule_" + i + " FROM myny.Test_Table ORDER BY Test_Table.boule_" + i + "; ";
|
||||
try {
|
||||
if(conn==null) {
|
||||
conn = maDB.getConnection();
|
||||
}
|
||||
if (conn != null) {
|
||||
Statement ps = conn.createStatement();
|
||||
rs = ps.executeQuery(sql);
|
||||
conn.commit();
|
||||
System.out.println("statement cree");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("chiffre1 probleme");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
//rs.next();
|
||||
while (rs.next()) {
|
||||
//System.out.println(numprec+", "+rs.getInt(2));
|
||||
if(numprec!=rs.getInt(2)) {k = 0;}
|
||||
while(numId[rs.getInt(2)][k]!=0){
|
||||
k++;
|
||||
}
|
||||
numId[rs.getInt(2)][k]=rs.getInt(1);
|
||||
//System.out.println(numId[rs.getInt(2)][k]);
|
||||
numprec=rs.getInt(2);
|
||||
}
|
||||
k=0;
|
||||
}
|
||||
for (int i=1; i<50;i++) {
|
||||
System.out.println(i+":"+numCpt[i][1]);
|
||||
while(numId[i][l]!=0){
|
||||
System.out.print(numId[i][l]+", ");
|
||||
l++;
|
||||
}
|
||||
System.out.println();
|
||||
l=0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On va essayer de trouver les correspondances d'identifiants entre le chiffre entre en parametre et les chiffres dans les lignes de la tables, pour les stocker dans un tableau, et sur un second qui va compter les correspondances entre le premier et les seconds chiffres potentiels
|
||||
* @param chiffre1 (int) le chiffre donne;
|
||||
* <p>i, j, k, l (int) sont des compteurs</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherCombinaisons2(int chiffre1) throws SQLException {
|
||||
afficherChiffre1();
|
||||
System.out.println("debut afficherCombinaisons2");
|
||||
numSelect[1]=chiffre1;
|
||||
int j=0, k=0, l=0;
|
||||
while (numId[chiffre1][j] != 0) {
|
||||
for(int i=1;i<50;i++) {
|
||||
if (i != chiffre1) {
|
||||
while (numId[i][k] != 0) {
|
||||
if (numId[i][k] == numId[chiffre1][j]) {
|
||||
//System.out.println("[i:"+i+"][k:"+k+"][j:"+j+"]");
|
||||
//System.out.println(numId[i][k] +"=="+ numId[chiffre1][j]);
|
||||
//combi1Cpt[i]++;
|
||||
combi1Id[i][(int)combi1Cpt[i]++]=numId[i][k];
|
||||
//System.out.println("[cpt:"+cpt+"]");
|
||||
}
|
||||
k++;
|
||||
}
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
for (int i=1; i<50;i++) {
|
||||
/*for (int p=0; p<50;p++) {
|
||||
System.out.print(combi1Id[i][p]+", ");
|
||||
}*/
|
||||
System.out.println(i+": "+combi1Cpt[i]);
|
||||
while(combi1Id[i][l]!=0){
|
||||
System.out.print(combi1Id[i][l]+", ");
|
||||
l++;
|
||||
}
|
||||
System.out.println();
|
||||
l=0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On va essayer de trouver les correspondances d'identifiants entre les 2 chiffres entres en parametre et les chiffres dans les lignes de la tables, pour les stocker dans un tableau, et sur un second qui va compter les correspondances entre le premier, le second et les troisièmes chiffres potentiels
|
||||
* @param chiffre1, (int) le premier chiffre donne;
|
||||
* @param chiffre2, (int) le second chiffre donne;
|
||||
* <p>i, j, k (int) sont des compteurs</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherCombinaisons3(int chiffre1, int chiffre2) throws SQLException {
|
||||
//afficherChiffre1();
|
||||
afficherCombinaisons2(chiffre1);
|
||||
System.out.println("debut afficherCombinaisons3");
|
||||
numSelect[2]=chiffre2;
|
||||
int j=0, k=0;
|
||||
while (combi1Id[chiffre2][j] != 0){
|
||||
for(int i=1;i<50;i++) {
|
||||
if (i != chiffre1 && i!=chiffre2) {
|
||||
while (numId[i][k] != 0) {
|
||||
if (numId[i][k] == combi1Id[chiffre2][j]) {
|
||||
combi2Id[i][(int)combi2Cpt[i]++]=numId[i][k];
|
||||
}
|
||||
k++;
|
||||
}
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
k = 0;
|
||||
for (int i=1; i<50;i++) {
|
||||
/*for (int p=0; p<50;p++) {
|
||||
System.out.print(combi1Id[i][p]+", ");
|
||||
}*/
|
||||
System.out.println(i+": "+combi2Cpt[i]);
|
||||
while(combi2Id[i][k]!=0){
|
||||
System.out.print(combi2Id[i][k]+", ");
|
||||
k++;
|
||||
}
|
||||
System.out.println();
|
||||
k=0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sert a recuperer le nombre d'apparitions de chaque numero bonus ainsi que leurs id (annee_numero_de_tirage) de la table dans la db
|
||||
* <p>i, k, l (int) sont des compteurs</p>
|
||||
* <p>numprec(int) verifie si on change de chiffre ou non</p>
|
||||
* <p>rs (ResultSet) sert a avoir des retours sur les requetes realisees</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherBonus() throws SQLException {
|
||||
System.out.println("debut afficherBonus");
|
||||
int k=0, numprec=0, l=0;
|
||||
ResultSet rs=null;
|
||||
String sql;
|
||||
sql = "SELECT Test_Table.numero_chance,Count(*) as 'cnt' FROM myny.Test_Table GROUP BY Test_Table.numero_chance; ";
|
||||
try {
|
||||
conn = maDB.getConnection();
|
||||
if (conn != null) {
|
||||
Statement ps = conn.createStatement();
|
||||
rs = ps.executeQuery(sql);
|
||||
conn.commit();
|
||||
System.out.println("statement cree");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("chiffre1 probleme");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
//rs.next();
|
||||
while (rs.next()) {
|
||||
bonusCpt[rs.getInt(1)][0] = rs.getInt(1);
|
||||
bonusCpt[rs.getInt(1)][1] = rs.getLong(2);
|
||||
|
||||
}
|
||||
/*for (int i=0; i<11;i++) {
|
||||
System.out.println(i+" :"+ bonusCpt[i][1]);
|
||||
}*/
|
||||
sql = "SELECT Test_Table.annee_numero_de_tirage, Test_Table.numero_chance FROM myny.Test_Table ORDER BY Test_Table.numero_chance; ";
|
||||
try {
|
||||
conn = maDB.getConnection();
|
||||
if (conn != null) {
|
||||
Statement ps = conn.createStatement();
|
||||
rs = ps.executeQuery(sql);
|
||||
conn.commit();
|
||||
System.out.println("statement cree");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("chiffre1 probleme");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
//rs.next();
|
||||
while (rs.next()) {
|
||||
//System.out.println(numprec+", "+rs.getInt(2));
|
||||
if(numprec!=rs.getInt(2)) {k = 0;}
|
||||
while(bonusId[rs.getInt(2)][k]!=0){
|
||||
k++;
|
||||
}
|
||||
bonusId[rs.getInt(2)][k]=rs.getInt(1);
|
||||
//System.out.println(bonusId[rs.getInt(2)][k]);
|
||||
numprec=rs.getInt(2);
|
||||
}
|
||||
for (int i=1; i<11;i++) {
|
||||
System.out.println(i+":"+bonusCpt[i][1]);
|
||||
while(bonusId[i][l]!=0){
|
||||
System.out.print(bonusId[i][l]+", ");
|
||||
l++;
|
||||
}
|
||||
System.out.println();
|
||||
l=0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On va essayer de trouver les correspondances d'identifiants entre le chiffre entre en parametre et les chiffres bonus potentiels dans les lignes de la tables, pour les stocker dans un tableau, et sur un second qui va compter les correspondances entre le premier chiffre et les seconds chiffres bonus potentiels
|
||||
* @param chiffre1, (int) le chiffre donne;
|
||||
* <p>i, j, k, l (int) sont des compteurs</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherNumBonus(int chiffre1) throws SQLException {
|
||||
afficherChiffre1();
|
||||
this.afficherBonus();
|
||||
System.out.println("debut afficherNumBonus");
|
||||
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=0;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
k = 0;
|
||||
j++;
|
||||
}
|
||||
j = 0;
|
||||
cpt=0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On va essayer de trouver les correspondances d'identifiants entre les 2 chiffres entres en parametre et les chiffres bonus potentiels dans les lignes de la tables, pour les stocker dans un tableau, et sur un second qui va compter les correspondances entre le premier chifre, le second chiffre et les chiffres bonus potentiels
|
||||
* @param chiffre1, (int) le premier chiffre donne;
|
||||
* @param chiffre2, (int) le second chiffre donne;
|
||||
* <p>i, j, k, l, cpt (int) sont des compteurs</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherNumBonusCombi2(int chiffre1, int chiffre2) throws SQLException {
|
||||
afficherCombinaisons2(chiffre1);
|
||||
afficherBonus();
|
||||
System.out.println("debut afficherNumBonusCombi2");
|
||||
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=0;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
k = 0;
|
||||
j++;
|
||||
}
|
||||
j = 0;
|
||||
cpt=0;
|
||||
}
|
||||
for (int i=0; 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On va essayer de trouver les correspondances d'identifiants entre les 3 chiffres entres en parametre et les chiffres bonus potentiels dans les lignes de la tables, pour les stocker dans un tableau, et sur un second qui va compter les correspondances entre le premier chifre, le second chiffre, le troisieme chiffre et les chiffres bonus potentiels
|
||||
* @param chiffre1, (int) le premier chiffre donne;
|
||||
* @param chiffre2, (int) le second chiffre donne;
|
||||
* @param chiffre3, (int) le troisieme chiffre donne;
|
||||
* <p>i, j, k, l (int) sont des compteurs</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherNumBonusCombi3(int chiffre1, int chiffre2, int chiffre3) throws SQLException {
|
||||
afficherCombinaisons3(chiffre1, chiffre2);
|
||||
afficherBonus();
|
||||
System.out.println("debut afficherNumBonusCombi3");
|
||||
numSelect[1]=chiffre1;
|
||||
numSelect[2]=chiffre2;
|
||||
numSelect[3]=chiffre3;
|
||||
int j=0, k=0, l=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];
|
||||
num3_bonusId[i][(int) num3_bonusCpt[i]++]=bonusId[i][k];
|
||||
j++;
|
||||
k=0;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
k = 0;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
for (int i=1; i<11;i++) {
|
||||
/*for (int p=0; p<50;p++) {
|
||||
System.out.print(num3_bonusId[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +1,474 @@
|
|||
package fr.myny.stats;
|
||||
|
||||
import fr.myny.database.DataBase;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* La classe Statistics qui sert a donner le nombre d'appartition de chaque chiffre/combinaison (et leurs ID si besoin)
|
||||
*/
|
||||
|
||||
|
||||
public class Statistics {
|
||||
|
||||
|
||||
public DataBase maDB;
|
||||
public Connection conn;
|
||||
public long numSelect[];
|
||||
public int bonusSelect;
|
||||
public long numId[][]; //liste des identifiants des lignes contenant un chiffre specifique
|
||||
public long numCpt[][]; //total d'apparitions de chaque chiffre
|
||||
public long bonusId[][]; //liste des identifiants des lignes contenant un chiffre bonus specifique
|
||||
public long bonusCpt[][]; //total d'apparitions de chaque bonus
|
||||
public long combi1Id[][]; //liste des identifiants des lignes cumulant 2 chiffres specifiques
|
||||
public long combi1Cpt[]; //total d'apparitions de chaque chiffre qui correspond egalement a un premier chiffre sur la meme ligne
|
||||
public long combi2Id[][]; //liste des identifiants des lignes cumulant 3 chiffres specifiques
|
||||
public long combi2Cpt[]; //total d'apparitions de chaque chiffre qui correspond egalement aux 2 premiers chiffres sur la meme ligne
|
||||
public long num1_bonusId[][]; //liste des identifiants des lignes cumulant 1 chiffre specifique et un numero bonus specifique
|
||||
public long num1_bonusCpt[]; //total d'apparitions de chaque bonus qui correspond egalement au premier chiffre sur la meme ligne
|
||||
public long num2_bonusId[][]; //liste des identifiants des lignes cumulant 2 chiffres specifiques et un numero bonus specifique
|
||||
public long num2_bonusCpt[]; //total d'apparitions de chaque bonus qui correspond egalement aux 2 premiers chiffres sur la meme ligne
|
||||
public long num3_bonusId[][]; //liste des identifiants des lignes cumulant 3 chiffres specifiques et un numero bonus specifique
|
||||
public long num3_bonusCpt[]; //total d'apparitions de chaque bonus qui correspond egalement aux 3 premiers chiffres sur la meme ligne
|
||||
public long taille;
|
||||
|
||||
/**
|
||||
* Le constructeur de Statistics
|
||||
* Constructeur, charge d'initialiser les differents champs
|
||||
* <p>Pour les tableaux, leurs tailles (de 4000) sont surevaluees pour pouvoir augmenter quandla table augmentera</p>
|
||||
* <p>Une solution optimale serait de fonctionner par exmple avec des TreeMap ou des ArrayLists a la place, pour eviter</p>
|
||||
* <p>d'utiliser trop de memoire inutilement</p>
|
||||
*/
|
||||
public Statistics(){
|
||||
|
||||
maDB=new DataBase();
|
||||
conn= maDB.getConnection();
|
||||
numSelect =new long[5];
|
||||
numId =new long[50][4000];
|
||||
numCpt = new long[50][2];
|
||||
combi1Id =new long[50][4000];
|
||||
combi1Cpt = new long[50];
|
||||
num1_bonusId =new long[11][4000];
|
||||
num1_bonusCpt = new long[11];
|
||||
num2_bonusId =new long[11][4000];
|
||||
num2_bonusCpt = new long[11];
|
||||
num3_bonusId =new long[11][4000];
|
||||
num3_bonusCpt = new long[11];
|
||||
combi2Id=new long[50][4000];
|
||||
combi2Cpt=new long[50];
|
||||
bonusId =new long[11][4000];
|
||||
bonusCpt=new long[11][2];
|
||||
}
|
||||
|
||||
/**
|
||||
* La methode de recuperation de la ou des valeurs les plus probables et leurs probabilites
|
||||
* TODO : choisir si on met une un valeur, plusieurs ou toutes
|
||||
* Sert a recuperer la taille de la table pour calculer la frequence d'apparition de la combinaison/du nombre considere
|
||||
*/
|
||||
public void getBestNb(){
|
||||
//TODO: enlever l'affichage
|
||||
public void setTaille(){
|
||||
/*on effectue un requete "SELECT Count(*) From myny.Test_Table"
|
||||
puis on l'affecte a une variable de l'objet Statistics*/
|
||||
try {
|
||||
conn = maDB.getConnection();
|
||||
if (conn != null) {
|
||||
Statement ps = conn.createStatement();
|
||||
ResultSet rs=ps.executeQuery("SELECT Count(*) From myny.Test_Table");
|
||||
rs.next();
|
||||
long nbcolret= rs.getLong(1);
|
||||
conn.commit();
|
||||
System.out.println("statement cree");
|
||||
taille =nbcolret;
|
||||
System.out.println(taille);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("chiffre1 probleme");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* La methode de recuperation de la valeur chance la plus probable et sa probabilites
|
||||
* TODO : choisir si on met une un valeur, plusieurs ou toutes
|
||||
* Sert a recuperer le nombre d'apparitions de chaque numero ainsi que leurs id (annee_numero_de_tirage) de la table dans la db
|
||||
* <p>i, k, l (int) sont des compteurs</p>
|
||||
* <p>numprec(int) verifie si on change de chiffre ou non</p>
|
||||
* <p>rs (ResultSet) sert a avoir des retours sur les requetes realisees</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
public void getBestNbLuck(){
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherChiffre1() throws SQLException {
|
||||
System.out.println("debut afficherChiffre1");
|
||||
int k=0, numprec=0, l=0;
|
||||
ResultSet rs=null;
|
||||
String sql;
|
||||
for (int i=1; i<6;i++) {
|
||||
//pour chaque colonne contenant une boule (non bonus) de la table, on va recuperer le nombre d'apparitions de chaque boule et le stocker dans un tableau
|
||||
sql = "SELECT Test_Table.boule_" + i + ",Count(*) as 'cnt' FROM myny.Test_Table GROUP BY Test_Table.boule_" + i + "; ";
|
||||
try {
|
||||
if(conn==null) {
|
||||
conn = maDB.getConnection();
|
||||
}
|
||||
if (conn != null) {
|
||||
Statement ps = conn.createStatement();
|
||||
rs = ps.executeQuery(sql);
|
||||
conn.commit();
|
||||
System.out.println("statement cree");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("chiffre1 probleme");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
while (rs.next()) {
|
||||
if (i == 1) {
|
||||
numCpt[rs.getInt(1)][0] = rs.getInt(1);
|
||||
numCpt[rs.getInt(1)][1] = rs.getLong(2);
|
||||
} else {
|
||||
numCpt[rs.getInt(1)][1] += rs.getLong(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=1; i<=5;i++) {
|
||||
//pour chaque colonne contenant une boule (non bonus) de la table, on va
|
||||
// recuperer les annee_numero_de_tirage correspondants et les stocker dans un tableau
|
||||
sql = "SELECT Test_Table.annee_numero_de_tirage, Test_Table.boule_" + i + " FROM myny.Test_Table ORDER BY Test_Table.boule_" + i + "; ";
|
||||
try {
|
||||
if(conn==null) {
|
||||
conn = maDB.getConnection();
|
||||
}
|
||||
if (conn != null) {
|
||||
Statement ps = conn.createStatement();
|
||||
rs = ps.executeQuery(sql);
|
||||
conn.commit();
|
||||
System.out.println("statement cree");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("chiffre1 probleme");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
//rs.next();
|
||||
while (rs.next()) {
|
||||
//System.out.println(numprec+", "+rs.getInt(2));
|
||||
if(numprec!=rs.getInt(2)) {k = 0;}
|
||||
while(numId[rs.getInt(2)][k]!=0){
|
||||
k++;
|
||||
}
|
||||
numId[rs.getInt(2)][k]=rs.getInt(1);
|
||||
//System.out.println(numId[rs.getInt(2)][k]);
|
||||
numprec=rs.getInt(2);
|
||||
}
|
||||
k=0;
|
||||
}
|
||||
for (int i=1; i<50;i++) {
|
||||
System.out.println(i+":"+numCpt[i][1]);
|
||||
while(numId[i][l]!=0){
|
||||
System.out.print(numId[i][l]+", ");
|
||||
l++;
|
||||
}
|
||||
System.out.println();
|
||||
l=0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On va essayer de trouver les correspondances d'identifiants entre le chiffre entre en parametre et les chiffres dans les lignes de la tables, pour les stocker dans un tableau, et sur un second qui va compter les correspondances entre le premier et les seconds chiffres potentiels
|
||||
* @param chiffre1 (int) le chiffre donne;
|
||||
* <p>i, j, k, l (int) sont des compteurs</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherCombinaisons2(int chiffre1) throws SQLException {
|
||||
afficherChiffre1();
|
||||
System.out.println("debut afficherCombinaisons2");
|
||||
numSelect[1]=chiffre1;
|
||||
int j=0, k=0, l=0;
|
||||
while (numId[chiffre1][j] != 0) {
|
||||
for(int i=1;i<50;i++) {
|
||||
if (i != chiffre1) {
|
||||
while (numId[i][k] != 0) {
|
||||
if (numId[i][k] == numId[chiffre1][j]) {
|
||||
//System.out.println("[i:"+i+"][k:"+k+"][j:"+j+"]");
|
||||
//System.out.println(numId[i][k] +"=="+ numId[chiffre1][j]);
|
||||
//combi1Cpt[i]++;
|
||||
combi1Id[i][(int)combi1Cpt[i]++]=numId[i][k];
|
||||
//System.out.println("[cpt:"+cpt+"]");
|
||||
}
|
||||
k++;
|
||||
}
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
for (int i=1; i<50;i++) {
|
||||
/*for (int p=0; p<50;p++) {
|
||||
System.out.print(combi1Id[i][p]+", ");
|
||||
}*/
|
||||
System.out.println(i+": "+combi1Cpt[i]);
|
||||
while(combi1Id[i][l]!=0){
|
||||
System.out.print(combi1Id[i][l]+", ");
|
||||
l++;
|
||||
}
|
||||
System.out.println();
|
||||
l=0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On va essayer de trouver les correspondances d'identifiants entre les 2 chiffres entres en parametre et les chiffres dans les lignes de la tables, pour les stocker dans un tableau, et sur un second qui va compter les correspondances entre le premier, le second et les troisièmes chiffres potentiels
|
||||
* @param chiffre1, (int) le premier chiffre donne;
|
||||
* @param chiffre2, (int) le second chiffre donne;
|
||||
* <p>i, j, k (int) sont des compteurs</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherCombinaisons3(int chiffre1, int chiffre2) throws SQLException {
|
||||
//afficherChiffre1();
|
||||
afficherCombinaisons2(chiffre1);
|
||||
System.out.println("debut afficherCombinaisons3");
|
||||
numSelect[2]=chiffre2;
|
||||
int j=0, k=0;
|
||||
while (combi1Id[chiffre2][j] != 0){
|
||||
for(int i=1;i<50;i++) {
|
||||
if (i != chiffre1 && i!=chiffre2) {
|
||||
while (numId[i][k] != 0) {
|
||||
if (numId[i][k] == combi1Id[chiffre2][j]) {
|
||||
combi2Id[i][(int)combi2Cpt[i]++]=numId[i][k];
|
||||
}
|
||||
k++;
|
||||
}
|
||||
k = 0;
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
k = 0;
|
||||
for (int i=1; i<50;i++) {
|
||||
/*for (int p=0; p<50;p++) {
|
||||
System.out.print(combi1Id[i][p]+", ");
|
||||
}*/
|
||||
System.out.println(i+": "+combi2Cpt[i]);
|
||||
while(combi2Id[i][k]!=0){
|
||||
System.out.print(combi2Id[i][k]+", ");
|
||||
k++;
|
||||
}
|
||||
System.out.println();
|
||||
k=0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sert a recuperer le nombre d'apparitions de chaque numero bonus ainsi que leurs id (annee_numero_de_tirage) de la table dans la db
|
||||
* <p>i, k, l (int) sont des compteurs</p>
|
||||
* <p>numprec(int) verifie si on change de chiffre ou non</p>
|
||||
* <p>rs (ResultSet) sert a avoir des retours sur les requetes realisees</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherBonus() throws SQLException {
|
||||
System.out.println("debut afficherBonus");
|
||||
int k=0, numprec=0, l=0;
|
||||
ResultSet rs=null;
|
||||
String sql;
|
||||
sql = "SELECT Test_Table.numero_chance,Count(*) as 'cnt' FROM myny.Test_Table GROUP BY Test_Table.numero_chance; ";
|
||||
try {
|
||||
conn = maDB.getConnection();
|
||||
if (conn != null) {
|
||||
Statement ps = conn.createStatement();
|
||||
rs = ps.executeQuery(sql);
|
||||
conn.commit();
|
||||
System.out.println("statement cree");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("chiffre1 probleme");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
//rs.next();
|
||||
while (rs.next()) {
|
||||
bonusCpt[rs.getInt(1)][0] = rs.getInt(1);
|
||||
bonusCpt[rs.getInt(1)][1] = rs.getLong(2);
|
||||
|
||||
}
|
||||
/*for (int i=0; i<11;i++) {
|
||||
System.out.println(i+" :"+ bonusCpt[i][1]);
|
||||
}*/
|
||||
sql = "SELECT Test_Table.annee_numero_de_tirage, Test_Table.numero_chance FROM myny.Test_Table ORDER BY Test_Table.numero_chance; ";
|
||||
try {
|
||||
conn = maDB.getConnection();
|
||||
if (conn != null) {
|
||||
Statement ps = conn.createStatement();
|
||||
rs = ps.executeQuery(sql);
|
||||
conn.commit();
|
||||
System.out.println("statement cree");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
System.out.println("chiffre1 probleme");
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
//rs.next();
|
||||
while (rs.next()) {
|
||||
//System.out.println(numprec+", "+rs.getInt(2));
|
||||
if(numprec!=rs.getInt(2)) {k = 0;}
|
||||
while(bonusId[rs.getInt(2)][k]!=0){
|
||||
k++;
|
||||
}
|
||||
bonusId[rs.getInt(2)][k]=rs.getInt(1);
|
||||
//System.out.println(bonusId[rs.getInt(2)][k]);
|
||||
numprec=rs.getInt(2);
|
||||
}
|
||||
for (int i=1; i<11;i++) {
|
||||
System.out.println(i+":"+bonusCpt[i][1]);
|
||||
while(bonusId[i][l]!=0){
|
||||
System.out.print(bonusId[i][l]+", ");
|
||||
l++;
|
||||
}
|
||||
System.out.println();
|
||||
l=0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* On va essayer de trouver les correspondances d'identifiants entre le chiffre entre en parametre et les chiffres bonus potentiels dans les lignes de la tables, pour les stocker dans un tableau, et sur un second qui va compter les correspondances entre le premier chiffre et les seconds chiffres bonus potentiels
|
||||
* @param chiffre1, (int) le chiffre donne;
|
||||
* <p>i, j, k, l (int) sont des compteurs</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherNumBonus(int chiffre1) throws SQLException {
|
||||
afficherChiffre1();
|
||||
this.afficherBonus();
|
||||
System.out.println("debut afficherNumBonus");
|
||||
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=0;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
k = 0;
|
||||
j++;
|
||||
}
|
||||
j = 0;
|
||||
cpt=0;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On va essayer de trouver les correspondances d'identifiants entre les 2 chiffres entres en parametre et les chiffres bonus potentiels dans les lignes de la tables, pour les stocker dans un tableau, et sur un second qui va compter les correspondances entre le premier chifre, le second chiffre et les chiffres bonus potentiels
|
||||
* @param chiffre1, (int) le premier chiffre donne;
|
||||
* @param chiffre2, (int) le second chiffre donne;
|
||||
* <p>i, j, k, l, cpt (int) sont des compteurs</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherNumBonusCombi2(int chiffre1, int chiffre2) throws SQLException {
|
||||
afficherCombinaisons2(chiffre1);
|
||||
afficherBonus();
|
||||
System.out.println("debut afficherNumBonusCombi2");
|
||||
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=0;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
k = 0;
|
||||
j++;
|
||||
}
|
||||
j = 0;
|
||||
cpt=0;
|
||||
}
|
||||
for (int i=0; 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On va essayer de trouver les correspondances d'identifiants entre les 3 chiffres entres en parametre et les chiffres bonus potentiels dans les lignes de la tables, pour les stocker dans un tableau, et sur un second qui va compter les correspondances entre le premier chifre, le second chiffre, le troisieme chiffre et les chiffres bonus potentiels
|
||||
* @param chiffre1, (int) le premier chiffre donne;
|
||||
* @param chiffre2, (int) le second chiffre donne;
|
||||
* @param chiffre3, (int) le troisieme chiffre donne;
|
||||
* <p>i, j, k, l (int) sont des compteurs</p>
|
||||
* @throws SQLException si erreur SQL
|
||||
*/
|
||||
//TODO: enlever l'affichage
|
||||
public void afficherNumBonusCombi3(int chiffre1, int chiffre2, int chiffre3) throws SQLException {
|
||||
afficherCombinaisons3(chiffre1, chiffre2);
|
||||
afficherBonus();
|
||||
System.out.println("debut afficherNumBonusCombi3");
|
||||
numSelect[1]=chiffre1;
|
||||
numSelect[2]=chiffre2;
|
||||
numSelect[3]=chiffre3;
|
||||
int j=0, k=0, l=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];
|
||||
num3_bonusId[i][(int) num3_bonusCpt[i]++]=bonusId[i][k];
|
||||
j++;
|
||||
k=0;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
k = 0;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
for (int i=1; i<11;i++) {
|
||||
/*for (int p=0; p<50;p++) {
|
||||
System.out.print(num3_bonusId[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +1,8 @@
|
|||
//import com.opencsv.CSVReader;
|
||||
//import com.opencsv.exceptions.CsvException;
|
||||
import fr.myny.database.DataBase;
|
||||
import fr.myny.stats.Choix;
|
||||
import fr.myny.stats.Statistics;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.io.*;
|
||||
//import com.opencsv.CSVReader;
|
||||
|
||||
public class test{
|
||||
|
|
@ -17,7 +12,7 @@ public class test{
|
|||
System.out.println("Il Je test les branchs");
|
||||
|
||||
|
||||
Choix c=new Choix();
|
||||
Statistics c=new Statistics();
|
||||
//c.setTaille();
|
||||
//c.afficherChiffre1();
|
||||
//c.afficherNumBonus();
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class ChoixTest {
|
||||
Choix c=new Choix();
|
||||
public class StatisticsTest {
|
||||
Statistics s =new Statistics();
|
||||
//c.setTaille();
|
||||
//c.afficherChiffre1();
|
||||
//c.afficherNumBonus();
|
||||
|
|
@ -17,39 +17,39 @@ public class ChoixTest {
|
|||
|
||||
@Test
|
||||
public void setTaille(){
|
||||
c.setTaille();
|
||||
s.setTaille();
|
||||
}
|
||||
@Test
|
||||
public void afficherChiffre1() throws SQLException{
|
||||
c.afficherChiffre1();
|
||||
s.afficherChiffre1();
|
||||
}
|
||||
@Test
|
||||
public void afficherCombinaisons2() throws SQLException{
|
||||
c.afficherCombinaisons2(4);
|
||||
s.afficherCombinaisons2(4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void afficherCombinaisons3() throws SQLException{
|
||||
c.afficherCombinaisons3(32,16);
|
||||
s.afficherCombinaisons3(32,16);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void afficherBonus() throws SQLException{
|
||||
c.afficherBonus();
|
||||
s.afficherBonus();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void afficherNumBonus() throws SQLException{
|
||||
c.afficherNumBonus(1);
|
||||
s.afficherNumBonus(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void afficherNumBonusCombi2() throws SQLException{
|
||||
c.afficherNumBonusCombi2(5,10);
|
||||
s.afficherNumBonusCombi2(5,10);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void afficherNumBonusCombi3() throws SQLException{
|
||||
c.afficherNumBonusCombi3(28,14,37);
|
||||
s.afficherNumBonusCombi3(28,14,37);
|
||||
}
|
||||
}
|
||||
Reference in a new issue