Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions OrientationProject/bin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/VerificateurCriteres.class
/VerificateurCriteresParallele.class
/VerificateurCriteresPrepa.class
/Exceptions/
Binary file modified OrientationProject/bin/Domaine.class
Binary file not shown.
Binary file modified OrientationProject/bin/Etudiant.class
Binary file not shown.
Binary file modified OrientationProject/bin/EtudiantParallele.class
Binary file not shown.
Binary file modified OrientationProject/bin/EtudiantPrepa.class
Binary file not shown.
Binary file modified OrientationProject/bin/Exceptions/domaineExistantException.class
Binary file not shown.
Binary file modified OrientationProject/bin/Exceptions/filiereExistantException.class
Binary file not shown.
Binary file modified OrientationProject/bin/Exceptions/matiereExistantException.class
Binary file not shown.
Binary file modified OrientationProject/bin/Filiere.class
Binary file not shown.
Binary file modified OrientationProject/bin/Institution.class
Binary file not shown.
37 changes: 22 additions & 15 deletions OrientationProject/src/Domaine.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;

public class Domaine implements Evaluate {
String nom;
Expand All @@ -8,21 +9,27 @@ public class Domaine implements Evaluate {


public String PeutAcceder(Etudiant E) {
String r = "";

for(int i=0;i<this.filieres.size();i++) {

if (this.filieres.get(i).PeutAccederFiliere(E)==true) {

r = r +" "+this.filieres.get(i).nom;

}
}
if(r.trim().isEmpty()){
return "ne peut rien acceder";
}

return r;
String r = "";
// Conversion temporaire en liste triée par ordre alphabetique du nom (pour future features en ce qui concerne l'interface)
List<Filiere> filieresTriees = new ArrayList<>(this.filieres);
Collections.sort(filieresTriees, new Comparator<Filiere>() {
@Override
public int compare(Filiere f1, Filiere f2) {
return f1.nom.compareTo(f2.nom);
}
});

for (Filiere filiere : filieresTriees) {
if (filiere.PeutAccederFiliere(E)) {
r += " " + filiere.nom;
}
}

if (r.trim().isEmpty()) {
return "ne peut rien acceder";
}

return r;
}


Expand Down
19 changes: 13 additions & 6 deletions OrientationProject/src/Etudiant.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public abstract class Etudiant {
String niveauEtude ; //bac+2 ou bac+3
String nomInstitutionActuel;
String TypeDiplome;
List<Domaine> domainesPreferees = new ArrayList<Domaine>();
HashSet<Domaine> domainesPreferees = new HashSet<>();
List<Filiere> filieresPreferees = new ArrayList<Filiere>();
int EtudiantID;
static int count = 0 ;
Expand Down Expand Up @@ -43,10 +43,12 @@ public void ajouterFilierePreferees(Filiere filiere) throws filiereExistantExcep
this.filieresPreferees.add(filiere);

}
public void ajouterDomainesPreferees(Domaine domaine) throws domaineExistantException {
if (this.domainesPreferees.contains(domaine)) throw new domainExistantException("domaine deja existe!");
this.domainesPreferees.add(domaine);
}
public void ajouterDomainesPreferees(Domaine domaine) {
if (!domainesPreferees.add(domaine)) {
// La méthode add retourne false si le domaine existe déjà
System.out.println("Le domaine existe déjà !");
}
}

public String filieresPrefereesPermis() {
String r="";
Expand All @@ -68,5 +70,10 @@ public String DomainesPrefereesPermis() {
return r;
}


public void setAge(int age) throws AgeNegatifException {
if (age < 0) {
throw new AgeNegatifException("L'âge ne peut pas être négatif.");
}
this.age = age;
}
}
42 changes: 28 additions & 14 deletions OrientationProject/src/EtudiantParallele.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,27 @@ public EtudiantParallele(String nom, String prenom, String CIN, String CNE, int

@Override
public String institutionPermis(List<Institution> L) {
String r = "";
for (int i = 0; i <L.size(); i++) {
if(L.get(i).PeutAcceder(this) != ""){

r = r + " "+L.get(i).nom;
}

}
return "les ecoles permis sont :" + r;
String r = "";
// Conversion temporaire en liste triée par nom
List<Institution> institutionsTriees = new ArrayList<>(L);
Collections.sort(institutionsTriees, new Comparator<Institution>() {
@Override
public int compare (Institution I1, Institusion I2 ) {
return I1.nom.compareTo(I2.nom);
}
});

for (Institution institution : institutionsTriees) {
if (!institution.PeutAcceder(this).isEmpty()) {
r += " " + institution.nom;
}
}

if (r.trim().isEmpty()) {
return "Aucune Institution n'est Permise!";
}

return "les ecoles permises sont :" + r;
}


Expand All @@ -37,7 +49,8 @@ public float getNoteDiplome() {



public void setNoteDiplome(float noteDiplome) {
public void setNoteDiplome(float noteDiplome) throws NoteException {
if (noteDiplome < 0 || noteDiplome > 20) throw new NoteException("La note doit être entre 0 et 20!");
this.noteDiplome = noteDiplome;
}

Expand Down Expand Up @@ -65,11 +78,11 @@ public float[] getNoteSemestre() {



public void setNoteSemestre(float noteSemestre[]) {
public void setNoteSemestre(float noteSemestre[]) throws NoteException {
for (noteSemestree: noteSemestre)
if (noteSemestree < 0 || noteSemestree > 20) throw new NoteException("Les note doivent être entre 0 et 20!");
this.noteSemestre = noteSemestre;



}


Expand All @@ -82,7 +95,8 @@ public int getClassementDansUniversitee() {



public void setClassementDansUniversitee(int classementDansUniversitee) {
public void setClassementDansUniversitee(int classementDansUniversitee) throws ClassementNegatifException {
if (classementDansUniversitee <= 0) throw new ClassementNegatifException ("Le classement doit être un entier positif.");
this.classementDansUniversitee = classementDansUniversitee;
}

Expand Down
60 changes: 28 additions & 32 deletions OrientationProject/src/EtudiantPrepa.java
Original file line number Diff line number Diff line change
@@ -1,64 +1,60 @@
import java.util.List;
import java.util.List;

public class EtudiantPrepa extends Etudiant {
private String filierePrepa; //mp/psi/tsi/ecs
private int classement ;





private int classement;



public EtudiantPrepa(String nom, String prenom, String CIN, String CNE, int age, String niveauEtude,
String nomInstitutionActuel, String TypeDiplome) {
String nomInstitutionActuel, String TypeDiplome) throws AgeNegatifException {
super(nom, prenom, CIN, CNE, age, niveauEtude, nomInstitutionActuel, TypeDiplome);
// TODO Auto-generated constructor stub
if (age < 0) throw new AgeNegatifException ("L'âge ne peut pas être négatif.");
}

@Override
public String institutionPermis(List<Institution> L) {
String r = "";
for (int i = 0; i <L.size(); i++) {
if(L.get(i).PeutAcceder(this) != ""){

r = r + " "+L.get(i).nom;
}
}
if (r.trim().isEmpty()) return "Aucune Institution n'est Permise!";
return "les ecoles permis sont :" + r;
String r = "";
// Conversion temporaire en liste triée par nom
List<Institution> institutionsTriees = new ArrayList<>(L);
Collections.sort(institutionsTriees, new Comparator<Institution>() {
@Override
public int compare (Institution I1, Institusion I2 ) {
return I1.nom.compareTo(I2.nom);
}
});

for (Institution institution : institutionsTriees) {
if (!institution.PeutAcceder(this).isEmpty()) {
r += " " + institution.nom;
}
}

if (r.trim().isEmpty()) {
return "Aucune Institution n'est Permise!";
}

return "les ecoles permises sont :" + r;
}






public String getFilierePrepa() {
return filierePrepa;
}





public void setFilierePrepa(String filierePrepa) {
this.filierePrepa = filierePrepa;
}





public int getClassement() {
return classement;
}





public void setClassement(int classement) {
public void setClassement(int classement) throws ClassementNegatifException {
if (classement <= 0) throw new ClassementNegatifException ("Le classement doit être un entier positif.");
this.classement = classement;
}

Expand Down
7 changes: 7 additions & 0 deletions OrientationProject/src/Exceptions/AgeNegatifException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

public class AgeNegatifException extends Exception {
public AgeNegatifException(String message) {
super(message);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

public class ClassementNegatifException extends Exception {
public ClassementNegatifException(String message) {
super(message);
}

}
7 changes: 7 additions & 0 deletions OrientationProject/src/Exceptions/NoteException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

public class NoteException extends Exception {
public NoteException(String message) {
super(message);
}

}
59 changes: 12 additions & 47 deletions OrientationProject/src/Filiere.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,53 +31,18 @@ public void ajouterCondition(ConditionEntree CE) {
this.CE=CE;
}











public boolean PeutAccederFiliere(Etudiant E) {
if(E instanceof EtudiantParallele) {
if (((EtudiantParallele) E).getClassementDansUniversitee() <= this.CE.classementUnivMin
&& ((EtudiantParallele) E).getNoteDiplome() >= this.CE.noteMinPara
&& E.age <= this.CE.ageMax) {
return true;
}
return false;


}
if(E instanceof EtudiantPrepa) {
if ( ((EtudiantPrepa)E).getFilierePrepa() == "mp" && E.age <= this.CE.ageMax) {
return ((EtudiantPrepa) E).getClassement() <= this.CE.classementMinMp;

}
if ( ((EtudiantPrepa)E).getFilierePrepa() == "psi" && E.age <= this.CE.ageMax ) {
return ((EtudiantPrepa) E).getClassement() <= this.CE.classementMinPsi;


}
if ( ((EtudiantPrepa)E).getFilierePrepa() == "tsi" && E.age <= this.CE.ageMax) {
return ((EtudiantPrepa) E).getClassement() <= this.CE.classementMinTsi;


}
if ( ((EtudiantPrepa)E).getFilierePrepa() == "ecs" && E.age <= this.CE.ageMax) {
return ((EtudiantPrepa) E).getClassement() <= this.CE.classementMinEc;


}
return false;


}
return false;
}
public boolean peutAccederFiliere(Etudiant etudiant) {
List<VerificateurCriteres> verificateurs = new ArrayList<>();
verificateurs.add(new VerificateurCriteresParallele());
verificateurs.add(new VerificateurCriteresPrepa());

for (VerificateurCriteres verificateur : verificateurs) {
if (verificateur.valider(etudiant, this.conditionAcces)) {
return true;
}
}
return false;
}



Expand Down
Loading