Compare commits

...

2 Commits

Author SHA1 Message Date
4d7c490f87 tp 2024-09-12 15:35:34 +02:00
fae997b0e8 tp 2024-09-12 15:34:31 +02:00
86 changed files with 2308 additions and 28 deletions

BIN
Automate/JFLAP7.1.jar Normal file

Binary file not shown.

554
Automate/TP0/Ex1.jff Normal file

File diff suppressed because it is too large Load Diff

296
Automate/TP0/Ex2.jff Normal file
View File

@ -0,0 +1,296 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--Created with JFLAP 7.1.--><structure>
<type>fa</type>
<automaton>
<!--The list of states.-->
<state id="0" name="q0">
<x>239.0</x>
<y>109.0</y>
</state>
<state id="1" name="0">
<x>96.0</x>
<y>289.0</y>
<final/>
</state>
<state id="2" name="q2">
<x>426.0</x>
<y>114.0</y>
<final/>
</state>
<state id="3" name="q3">
<x>100.0</x>
<y>107.0</y>
</state>
<state id="4" name="2*n+1">
<x>240.0</x>
<y>288.0</y>
<final/>
</state>
<state id="5" name="2*n">
<x>389.0</x>
<y>289.0</y>
<final/>
</state>
<state id="6" name="n">
<x>63.0</x>
<y>465.0</y>
</state>
<state id="7" name="0mod3">
<x>253.0</x>
<y>401.0</y>
</state>
<state id="8" name="1mod3">
<x>248.0</x>
<y>522.0</y>
<final/>
</state>
<state id="9" name="2mod3">
<x>391.0</x>
<y>459.0</y>
</state>
<state id="10" name="n">
<x>632.0</x>
<y>89.0</y>
<initial/>
</state>
<state id="11" name="2mod9">
<x>888.0</x>
<y>-64.0</y>
</state>
<state id="12" name="3mod9">
<x>930.0</x>
<y>301.0</y>
</state>
<state id="13" name="4mod9">
<x>1119.0</x>
<y>-61.0</y>
</state>
<state id="14" name="5mod9">
<x>950.0</x>
<y>119.0</y>
</state>
<state id="15" name="6mod9">
<x>1079.0</x>
<y>124.0</y>
</state>
<state id="16" name="7mod9">
<x>1202.0</x>
<y>309.0</y>
</state>
<state id="17" name="8mod9">
<x>1316.0</x>
<y>111.0</y>
</state>
<state id="18" name="0mod9">
<x>766.0</x>
<y>181.0</y>
<final/>
</state>
<state id="19" name="1mod9">
<x>771.0</x>
<y>15.0</y>
</state>
<!--The list of transitions.-->
<transition>
<from>17</from>
<to>16</to>
<read>0</read>
</transition>
<transition>
<from>14</from>
<to>19</to>
<read>0</read>
</transition>
<transition>
<from>8</from>
<to>9</to>
<read>0</read>
</transition>
<transition>
<from>9</from>
<to>8</to>
<read>0</read>
</transition>
<transition>
<from>3</from>
<to>0</to>
<read>a</read>
</transition>
<transition>
<from>13</from>
<to>18</to>
<read>1</read>
</transition>
<transition>
<from>15</from>
<to>13</to>
<read>1</read>
</transition>
<transition>
<from>18</from>
<to>19</to>
<read>1</read>
</transition>
<transition>
<from>10</from>
<to>18</to>
<read>0</read>
</transition>
<transition>
<from>19</from>
<to>11</to>
<read>0</read>
</transition>
<transition>
<from>19</from>
<to>12</to>
<read>1</read>
</transition>
<transition>
<from>1</from>
<to>4</to>
<read>1</read>
</transition>
<transition>
<from>11</from>
<to>13</to>
<read>0</read>
</transition>
<transition>
<from>0</from>
<to>2</to>
<read>b</read>
</transition>
<transition>
<from>2</from>
<to>0</to>
<read>a</read>
</transition>
<transition>
<from>12</from>
<to>15</to>
<read>0</read>
</transition>
<transition>
<from>15</from>
<to>12</to>
<read>0</read>
</transition>
<transition>
<from>0</from>
<to>0</to>
<read>a</read>
</transition>
<transition>
<from>2</from>
<to>2</to>
<read>b</read>
</transition>
<transition>
<from>4</from>
<to>5</to>
<read>0</read>
</transition>
<transition>
<from>5</from>
<to>4</to>
<read>1</read>
</transition>
<transition>
<from>13</from>
<to>17</to>
<read>0</read>
</transition>
<transition>
<from>7</from>
<to>8</to>
<read>1</read>
</transition>
<transition>
<from>8</from>
<to>7</to>
<read>1</read>
</transition>
<transition>
<from>11</from>
<to>14</to>
<read>1</read>
</transition>
<transition>
<from>14</from>
<to>11</to>
<read>1</read>
</transition>
<transition>
<from>16</from>
<to>14</to>
<read>0</read>
</transition>
<transition>
<from>10</from>
<to>19</to>
<read>1</read>
</transition>
<transition>
<from>16</from>
<to>15</to>
<read>1</read>
</transition>
<transition>
<from>6</from>
<to>8</to>
<read>1</read>
</transition>
<transition>
<from>1</from>
<to>1</to>
<read>0</read>
</transition>
<transition>
<from>5</from>
<to>5</to>
<read>0</read>
</transition>
<transition>
<from>7</from>
<to>7</to>
<read>0</read>
</transition>
<transition>
<from>18</from>
<to>18</to>
<controlx>795</controlx>
<controly>188</controly>
<read>0</read>
</transition>
<transition>
<from>4</from>
<to>4</to>
<read>1</read>
</transition>
<transition>
<from>9</from>
<to>9</to>
<read>1</read>
</transition>
<transition>
<from>17</from>
<to>17</to>
<read>1</read>
</transition>
<transition>
<from>6</from>
<to>7</to>
<read>0</read>
</transition>
<transition>
<from>12</from>
<to>16</to>
<read>1</read>
</transition>
<note>
<text/>
<x>286.0</x>
<y>756.0</y>
</note>
</automaton>
</structure>

73
Automate/TP0/TP2NDA.jff Normal file
View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--Created with JFLAP 6.4.--><structure>
<type>fa</type>
<automaton>
<!--The list of states.-->
<state id="0" name="q0">
<x>67.0</x>
<y>118.0</y>
<initial/>
</state>
<state id="1" name="q1">
<x>148.0</x>
<y>51.0</y>
</state>
<state id="2" name="q2">
<x>149.0</x>
<y>162.0</y>
</state>
<state id="3" name="q3">
<x>261.0</x>
<y>49.0</y>
</state>
<state id="4" name="q4">
<x>262.0</x>
<y>162.0</y>
</state>
<state id="5" name="q5">
<x>382.0</x>
<y>51.0</y>
<final/>
</state>
<state id="6" name="q6">
<x>388.0</x>
<y>166.0</y>
<final/>
</state>
<!--The list of transitions.-->
<transition>
<from>4</from>
<to>6</to>
<read>a</read>
</transition>
<transition>
<from>0</from>
<to>0</to>
<read>b</read>
</transition>
<transition>
<from>0</from>
<to>2</to>
<read>a</read>
</transition>
<transition>
<from>2</from>
<to>4</to>
<read>a</read>
</transition>
<transition>
<from>1</from>
<to>3</to>
<read>b</read>
</transition>
<transition>
<from>0</from>
<to>1</to>
<read>a</read>
</transition>
<transition>
<from>3</from>
<to>5</to>
<read>b</read>
</transition>
</automaton>
</structure>

20
Automate/TP0/n2n2n+1 Normal file
View File

@ -0,0 +1,20 @@
n 2n 2n+1
0 mod3 0 mod3 1 mod3
1 mod3 2 mod3 0 mod3
2 mod3 1 mod3 2 mod3
0 1
zéro zéro un
un deux zéro
deux un deux
n 2n 2n+1
0 mod9 0 mod9 1 mod9
1 mod9 2 mod9 3 mod9
2 mod9 4 mod9 5 mod9
3 mod9 6 mod9 7 mod9
4 mod9 8 mod9 0 mod9
5 mod9 1 mod9 2 mod9
6 mod9 3 mod9 4 mod9
7 mod9 5 mod9 6 mod9
8 mod9 7 mod9 8 mod9

View File

@ -0,0 +1,45 @@
import org.mariadb.jdbc.*;
import java.sql.*;
public class Vote{
public static void main(String[] args) {
int total = 0;
try{
Class.forName("org.mariadb.jdbc.Driver");
try{
Connection cnx = DriverManager.getConnection(
"jdbc:mariadb://dwarves.iut-fbleau.fr/pourchot",
"pourchot", "supermotdepasseultrafort");
try{
PreparedStatement pst = cnx.prepareStatement(
"SELECT p1.nom, p2.nom, v.Points FROM Vote v "
+"LEFT JOIN Pays p1 ON v.Competiteur = p1.Id "
+"LEFT JOIN Pays p2 ON v.Votants = p2.Id "
+"WHERE p1.nom = (?);");
pst.setString(1, args[0]);
ResultSet rs = pst.executeQuery();
while(rs.next()) {
System.out.println(rs.getString(2)+" "+" "+rs.getInt(3));
total+=rs.getInt(3);
}
System.out.println(" ---");
System.out.println("Total "+total);
rs.close();
pst.close();
cnx.close();
//System.out.println(rs.isClosed());
//System.out.println(pst.isClosed());
//System.out.println(cnx.isClosed());
} catch (SQLException e){
System.err.println("Requête échoué");
cnx.close();
//System.out.println(cnx.isClosed());
}
} catch (SQLException e){
System.err.println("Connexion à la base de donnée échouée");
}
} catch (ClassNotFoundException e){
System.err.println("Mauvais classpath");
}
}
}

Binary file not shown.

View File

@ -9,8 +9,8 @@ public class Changement{
InputStream file = loader.getResourceAsStream("Main.java");
InputStream file2 = loader.getResourceAsStream("Listeimage.java");
static public void fenetreCliquer(int LR){
Main.fenetre.remove(Main.pan);
Main.pan.remove(Listeimage.liste[Listeimage.index]);
Main.fenetre.remove(Main.fenetre.pan);
Main.fenetre.pan.remove(Listeimage.liste[Listeimage.index]);
if (LR==1){
Listeimage.index=Listeimage.index+1;
if(Listeimage.index>4){
@ -22,8 +22,8 @@ public class Changement{
Listeimage.index=4;
}
}
Main.pan.add(Listeimage.liste[Listeimage.index]);
Main.fenetre.setContentPane(Main.pan);
Main.fenetre.repaint();
Main.fenetre.pan.add(Listeimage.liste[Listeimage.index]);
Main.fenetre.setContentPane(Main.fenetre.pan);
Main.fenetre.revalidate();
}
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,45 @@
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
public class Fenetre extends JFrame{
static Galerie pan = new Galerie();
private ClassLoader loader = Thread.currentThread().getContextClassLoader();
private InputStream file = loader.getResourceAsStream("Galerie.java");
public Fenetre(){
pan.add(Listeimage.liste[Listeimage.index]);
this.setSize(250, 250);
this.setLocation(500, 500);
this.addMouseListener(pan);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.setContentPane(pan);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
if(fermerFenetre()==true){
dispose();
System.exit(0);
}
return;
}
});
}
private boolean fermerFenetre() {
JOptionPane option = new JOptionPane("Voulez-vous vraiment quitter ce programme ?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION);
JDialog confirmation = option.createDialog(this, "Confirmation de fermeture");
confirmation.setSize(400, 120);
confirmation.setLocation(450, 550);
confirmation.setVisible(true);
int result = (int) option.getValue();
confirmation.dispose();
return result == JOptionPane.YES_OPTION;
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,14 @@
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
public class Main{
static Fenetre fenetre = new Fenetre();
public static void main(String[] args) {
fenetre.setVisible(true);
}
}

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

View File

@ -0,0 +1,19 @@
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
public class Changement{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream file = loader.getResourceAsStream("Main.java");
InputStream file2 = loader.getResourceAsStream("Listeimage.java");
static public void fenetreCliquer(int LR){
if (LR==1){
Main.fenetre.pan.card.next(Main.fenetre.pan);
}else {
Main.fenetre.pan.card.previous(Main.fenetre.pan);
}
Main.fenetre.revalidate();
}
}

View File

@ -0,0 +1,23 @@
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
public class Fenetre extends JFrame{
static Galerie pan = new Galerie();
private ClassLoader loader = Thread.currentThread().getContextClassLoader();
private InputStream file = loader.getResourceAsStream("Galerie.java");
static int x;
public Fenetre(){
for (x=0; x<=4; x++) {
pan.add(Listeimage.liste[x]);
}
this.setSize(250, 250);
this.setLocation(250, 250);
this.addMouseListener(pan);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setContentPane(pan);
}
}

View File

@ -0,0 +1,39 @@
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
public class Galerie extends JPanel implements MouseListener{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream file = loader.getResourceAsStream("Changement.java");
static CardLayout card = new CardLayout();
public Galerie(){
super();
this.setLayout(card);
}
public void mouseClicked(MouseEvent e){
int x = e.getX();
if (x <= this.getWidth()/5){
Changement.fenetreCliquer(0);
}else if(x >= (this.getWidth()/5)*4){
Changement.fenetreCliquer(1);
}
}
public void mouseEntered(MouseEvent evenement){
}
public void mouseExited(MouseEvent evenement){
}
public void mousePressed(MouseEvent evenement){
}
public void mouseReleased(MouseEvent evenement){
}
}

View File

@ -0,0 +1,18 @@
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
public class Listeimage{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
static JLabel image1 = new JLabel(new ImageIcon("./img/image1.jpg"));
static JLabel image2 = new JLabel(new ImageIcon("./img/image2.jpg"));
static JLabel image3 = new JLabel(new ImageIcon("./img/image3.jpg"));
static JLabel image4 = new JLabel(new ImageIcon("./img/image4.jpg"));
static JLabel image5 = new JLabel(new ImageIcon("./img/image5.jpg"));
static JLabel[] liste = {image1, image2, image3, image4, image5};
static int index=0;
}

View File

@ -0,0 +1,14 @@
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
public class Main{
static Fenetre fenetre = new Fenetre();
public static void main(String[] args) {
fenetre.setVisible(true);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -0,0 +1,29 @@
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
public class Changement{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream file = loader.getResourceAsStream("Main.java");
InputStream file2 = loader.getResourceAsStream("Listeimage.java");
static public void fenetreCliquer(int LR){
Main.fenetre.remove(Main.fenetre.pan);
Main.fenetre.pan.remove(Listeimage.liste[Listeimage.index]);
if (LR==1){
Listeimage.index=Listeimage.index+1;
if(Listeimage.index>4){
Listeimage.index=0;
}
}else {
Listeimage.index=Listeimage.index-1;
if(Listeimage.index<0){
Listeimage.index=4;
}
}
Main.fenetre.pan.add(Listeimage.liste[Listeimage.index]);
Main.fenetre.setContentPane(Main.fenetre.pan);
Main.fenetre.revalidate();
}
}

View File

@ -0,0 +1,20 @@
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
public class Fenetre extends JFrame{
static Galerie pan = new Galerie();
private ClassLoader loader = Thread.currentThread().getContextClassLoader();
private InputStream file = loader.getResourceAsStream("Galerie.java");
public Fenetre(){
pan.add(Listeimage.liste[Listeimage.index]);
this.setSize(250, 250);
this.setLocation(250, 250);
this.addMouseListener(pan);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setContentPane(pan);
}
}

View File

@ -0,0 +1,36 @@
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
public class Galerie extends JPanel implements MouseListener{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream file = loader.getResourceAsStream("Changement.java");
public Galerie(){
super();
}
public void mouseClicked(MouseEvent e){
int x = e.getX();
if (x <= this.getWidth()/5){
Changement.fenetreCliquer(0);
}else if(x >= (this.getWidth()/5)*4){
Changement.fenetreCliquer(1);
}
}
public void mouseEntered(MouseEvent evenement){
}
public void mouseExited(MouseEvent evenement){
}
public void mousePressed(MouseEvent evenement){
}
public void mouseReleased(MouseEvent evenement){
}
}

View File

@ -0,0 +1,18 @@
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
public class Listeimage{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
static JLabel image1 = new JLabel(new ImageIcon("./img/image1.jpg"));
static JLabel image2 = new JLabel(new ImageIcon("./img/image2.jpg"));
static JLabel image3 = new JLabel(new ImageIcon("./img/image3.jpg"));
static JLabel image4 = new JLabel(new ImageIcon("./img/image4.jpg"));
static JLabel image5 = new JLabel(new ImageIcon("./img/image5.jpg"));
static JLabel[] liste = {image1, image2, image3, image4, image5};
static int index=0;
}

View File

@ -0,0 +1,14 @@
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.io.*;
public class Main{
static Fenetre fenetre = new Fenetre();
public static void main(String[] args) {
fenetre.setVisible(true);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Some files were not shown because too many files have changed in this diff Show More