1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110
|
package donnee;
import donnee.cration.Qperso;
import java.awt.Frame;
import java.util.*;
import java.io.*;
import argenne.*;
/**
* Enregistrement des données personnelles.
* Un fichier par personne contenant toutes les infos et l'adresse de l'image.
* Implémente java.io.Serializable pour le stocker sur le disque.
*/
public class Perso implements java.io.Serializable {
private static final long serialVersionUID = 1;
/**
* Identification des personnes. ext 1.1.1 est l'aîné de la branche aînée de la branche aîné...
*/
private String id;
/**
* Nom de la personne.
*/
private String nom;
/**
* Prénom de la personne.
*/
private String prenom;
/**
* Jour de la date de naissance de la personne.
*/
private int njour=-1;
/**
* Mois de la date de naissance de la personne.
*/
private int nmois=-1;
/**
* Année de la date de naissance de la personne.
*/
private int nan=-1;
/**
* Lieux de naissance de la personne.
*/
private String lieuxn;
/**
* Sexe de la personne ;
* true = sexe masculin, false = sexe féminin.
*/
private Boolean sex=true;
/**
* Indique si la personne est décédée;true = oui ; false = non.
*/
private Boolean deces=false;
/**
* Jour de la mort.
*/
private int mjour=-1;
/**
* Mois de la mort.
*/
private int mmoi=-1;
/**
* Année de la mort.
*/
private int man=-1;
/**
* Lieux de la mort.
*/
private String lieuxM;
/**
* Note sur la personne (note de l'utilisateur).
*/
private String note;
/**
* Id du perré.
*/
private int idPere=-1;
/**
* Id de la mère.
*/
private int idMere=-1;
/**
* Liste des Id des conjoints.
*/
private Vector <Integer> conj; /*stock les id des conjoints*/
/**
* Type de conjoints correspondant à l'id de conj.
*/
private Vector <String> conjty; /*stock les types de conjoint des conjoints*/
/**
* Liste des enfants.
*/
private Vector <Integer> enf; /* stock tout les id des enfants*/
/**
* Le titre de la personne
*/
private String titre;
/**
* Enregistre la biographie.
* Le premier vecteur donne la personne, le deuxième contient les lignes du texte.
*/
private String biographie;
/**
* Mets la photo en mémoire.
*/
private File photo;
/**
*
* Adresse. Le premier vecteur est la personne et le deuxième les adresse (0=1ére adresse ...).
*/
private Vector<String> adresse;
/**
* Type d'adresse. (Bureaux, maison,maison vacance ...).
*/
private Vector<String> tyAdresse;
/**
* Téléphone.
* Le premier vecteur est la personne et le deuxième leur num de téléphone.
* (0=1ére téléphone...).
*/
private Vector<String> telephone;
/**
* Type de téléphone.
* (Bureaux, maison ,maison vacance ...).
*/
private Vector<String> tyTel;
/**
* Fax.
*/
private Vector<String> fax;
/**
* Type de Fax.(bureaux, maison,maison vacance ...).
*/
private Vector<String> tyFax;
/**
* Adresse e-mail.
*/
private Vector<String> mail;
/**
* Type d'Email. (Bureaux, maison,maison vacance ...).
*/
private Vector<String> tyMail;
/**
* Adresse site web.
*/
private Vector<String> web;
/**
* Type d'adresse du site web. (Perso, entreprise, ou autre).
*/
private Vector<String> tyWeb;
private int[] ordre;
//-------------------------------------------------------------------------------
/**
* Constucteur.
*/
public Perso(Frame owner)/*constructeur*/
{
adresse=new Vector<String>();
conj=new Vector<Integer>();
conjty=new Vector<String>();
enf=new Vector<Integer>();
fax=new Vector<String>();
mail=new Vector<String>();
telephone=new Vector<String>();
tyAdresse=new Vector<String>();
tyFax=new Vector<String>();
tyMail=new Vector<String>();
tyTel=new Vector<String>();
tyWeb=new Vector<String>();
web=new Vector<String>();
}
public int[] getOrdre() {
return ordre;
}
public void setOrdre(int[] ordre) {
this.ordre = ordre;
}
/**
* Retourne le nom d'une personne.
* @return string
*/
public String getnom ()
{
return nom;
}
/**
* Retourne le nom d'une personne.
* @return string
*/
public String getprenom ()
{
return prenom;
}
/**
* Donne le jour de la naissance.
* @return string
*/
public int getnJour ()
{
return njour;
}
/**
* Donne le mois de la naissance.
* @return int
*/
public int getnMois ()
{
return nmois;
}
/**
* Donne l'année de la naissance.
* @return int
*/
public int getnAn ()
{
return nan;
}
/**
* Donne la date de naissance sous la forme "15/5/1987".
* @return int
*/
public String dateNaissanceChiffre()
{
return (java.lang.Integer.toString(njour)+'/'+java.lang.Integer.toString(nmois)+'/'+java.lang.Integer.toString(nan));
}
/**
* Donne la date de naissance sous la forme "le 15 mai 1982".
* @return string
*/
public String dateNaissancelettre()
{
String mois="";
switch (nmois)
{
case 1:
mois=Main.getTextLang("January");
break;
case 2:
mois=Main.getTextLang("February");
break;
case 3:
mois=Main.getTextLang("March");
break;
case 4:
mois=Main.getTextLang("April");
break;
case 5:
mois=Main.getTextLang("May");
break;
case 6:
mois=Main.getTextLang("June");
break;
case 7:
mois=Main.getTextLang("July");
break;
case 8:
mois=Main.getTextLang("August");
break;
case 9:
mois=Main.getTextLang("September");
break;
case 10:
mois=Main.getTextLang("October");
break;
case 11:
mois=Main.getTextLang("November");
break;
case 12:
mois=Main.getTextLang("December");
break;
}
return (Main.getTextLang("the")+java.lang.Integer.toString(njour)+' '+mois+' '+java.lang.Integer.toString(nan));
}
/**
* Donne le lieu de naissance
* @return string
*/
public String getlieuxN ()
{
return lieuxn;
}
/**
* Donne le sexe de la personne (Masculin/Féminin) en toutes lettres
* @return string
*/
public String getSexLettre()
{
if(sex)
{
return Main.getTextLang("male") ;
}
else
{
return Main.getTextLang("female") ;
}
}
/**
* Dit si la personne est morte au pas et l'indique en toutes lettres (décéder/vivant).
* @return string
*/
public String getDecesLettre()
{
if(deces)
{
return Main.getTextLang("dead");
}
else
{
return Main.getTextLang("alive") ;
}
}
/**
* Donne le sexe de la personne sous forme booléan .
* true=M et false=F.
* @return boolean
*/
public boolean getSexBool()
{
if(sex)
{
return true;
}
else
{
return false;
}
}
/**
* Dit si la personne est décédée sous forme booléan.
* true=décédé; false= en vie.
* @return boolean
*/
public boolean getDecesBool()
{
if(deces)
{
return true;
}
else
{
return false;
}
}
/**
* Donne la date de la mort sous la forme "12/5/1987".
* @return string
*/
public String dateMortChiffre()
{
return (java.lang.Integer.toString(mjour)+'/'+java.lang.Integer.toString(mmoi)+'/'+java.lang.Integer.toString(man));
}
/**
* Donne la date de la mort sous la forme "le 15 mai 1875".
* @return string
*/
public String dateMortlettre()
{
String mois="";
switch (mmoi)
{
case 1:
mois=Main.getTextLang("January");
break;
case 2:
mois=Main.getTextLang("February");
break;
case 3:
mois=Main.getTextLang("March");
break;
case 4:
mois=Main.getTextLang("April");
break;
case 5:
mois=Main.getTextLang("May");
break;
case 6:
mois=Main.getTextLang("June");
break;
case 7:
mois=Main.getTextLang("July");
break;
case 8:
mois=Main.getTextLang("August");
break;
case 9:
mois=Main.getTextLang("September");
break;
case 10:
mois=Main.getTextLang("October");
break;
case 11:
mois=Main.getTextLang("November");
break;
case 12:
mois=Main.getTextLang("December");
break;
}
return (Main.getTextLang("the")+java.lang.Integer.toString(mjour)+' '+mois+' '+java.lang.Integer.toString(man));
}
/**
* Donne les notes mises sur cette personne par l'utilisateur.
* ligne=ligne du texte.
* @return string
*/
public String getnote()
{
return note;
}
/**
* Donne le lieu de la mort.
* @return string
*/
public String getlieuxM ()
{
return lieuxM;
}
/**
* Donne l'Id du père.
* @return string (un id)
*/
public int getidPere ()
{
return idPere;
}
/**
* Donne l'Id de la mère.
* @return string (un id)
*/
public int getidMere ()
{
return idMere;
}
/**
* Donne l'Id du premier conjoint de la liste.
* num = numéro de la personne dont on cherche le conjoint.
* numconj = numéro du conjoint de num.
* @return string (un id).
*/
public int getconj(int numconj)
{
return conj.elementAt(numconj);
}
/**
* Donne le nom d'un enfant.
* num=numéro de la personne.
* numenf = numéro de l'enfant.
* @return string (un id)
*/
public int getenf (int numenf)
{
return enf.elementAt(numenf);
}
/**
* Donne le nom de tous les enfants.
* num=numéro de la personne.
* @return string (un id)
*/
public Vector getAllenf ()
{
return enf;
}
/**
* Donne le nombre d'enfants de la personne
* @return ne nombre d'enfant.
*/
public int getnumenf(){
return enf.size();
}
/**
* Nombre de conjoints
* @return le nombre de conjoints de la personne.
*/
public int getnumconj(){
return conj.size();
}
/**
* Donne tous les conjoints
* @return le nombre de conjoints de la personne.
*/
public Vector getAllConj(){
return conj;
}
/**
* Donne le type du conjoint numéro numconj
* @param numconj numéro du conjoint.
* @return string (un type. Par ex:marie,divorcé,fiancée.)
*/
public String getconjty (int numconj)
{
return conjty.elementAt(numconj);
}
/**
* Renvoie le titre de la personne.
* @return string
*/
public String gettitre (){
return titre;
}
/**
*Renvoie l'adresse d'une personne.
*numadr= numéro de l'adresse
*@return string
*/
public String getadresse(int numadr){
return adresse.elementAt(numadr);
}
/**
*Renvoie toutes les adresses d'une personne.
*@return string
*/
public String getAllAdresse(){
if (adresse.isEmpty())
return null;
String a=adresse.toString();
a=a.replace('[',' ');
return a.replace(']',' ');
}
/**
*Renvoie toutes les adresses avec leur type d'une personne.
*@return string
*/
public String getAllAdresseEtType(){
if (adresse.isEmpty())
return null;
StringBuffer a=new StringBuffer();
for(int i=0;i<adresse.size();i++){
a.append("["+this.tyAdresse.get(i)+"] "+this.adresse.get(i)+", ");
}
a.delete(a.length()-2,a.length());
return a.toString();
}
/**
* Tout les enfants de la personne
* @param gestion class gestion de la famille
* @return une chaine avec tous les enfants
*/
public String getStringAllEnf(){
StringBuffer s=new StringBuffer();
for (int i=0;i<enf.size();i++){
s.append(Main.gest().getNomPrenom((Integer)enf.get(i))+", ");
}
if (s.length()==0){return null;}
s.delete(s.length()-2, s.length());
return s.toString();
}
/**
* Tout les conjoints de la personne
* @param gestion class gestion de la famille
* @return une chaine avec tous les conjoint
*/
public String getStringAllConj(){
StringBuffer s=new StringBuffer();
for (int i=0;i<conj.size();i++){
s.append(Main.gest().getNomPrenom((Integer)conj.get(i))+", ");
}
if (s.length()==0){return null;}
s.delete(s.length()-2, s.length());
return s.toString();
}
/**
* Tout les conjoints de la personne avec leur type
* @param gestion class gestion de la famille
* @return une chaine avec tous les conjoint + type
*/
public String getStringAllConjType(){
StringBuffer s=new StringBuffer();
for (int i=0;i<conj.size();i++){
s.append("["+getconjty(i)+"] "+Main.gest().getNomPrenom((Integer)conj.get(i))+", ");
}
if (s.length()==0){return null;}
s.delete(s.length()-2, s.length());
return s.toString();
}
/**
* le père
* @param gestion class gestion de la famille
* @return une chaine du type : "Père : nometprénomdupère"
*/
public String getStringPere(){
return (argenne.Main.getTextLang("father")+" : "+Main.gest().getNomPrenom(this.idPere));
}
/**
* la mère
* @param gestion class gestion de la famille
* @return une chaine du type : "mère : nometprénomdelamère"
*/
public String getStringMere(){
return (argenne.Main.getTextLang("mother")+" : "+Main.gest().getNomPrenom(this.idMere));
}
/**
* Renvoie le type de l'adresse .
* numadr= numéro de l'adresse
* @return string
*/
public String gettypeadresse( int numadr){
return tyAdresse.elementAt(numadr);
}
/**
* Renvois une ligne de la biographie
* num = numéro de la personne
* ligne = ligne voulue
* @return String
*/
public String getbiographie(){
return biographie;
}
/**
* Renvois l'adresse des photos
* @return String [adresse]
*/
public File getphoto (){
return photo;
}
/**
* Renvoie le numéro de téléphone téléphone
* @return String[des numéros]
*
*/
public String gettelephone (int numtel){
return telephone.elementAt(numtel);
}
/**
* Renvoie tous les numéros de téléphone
* @return String[des numéros]
*
*/
public String getAllTelephone(){
if(telephone.isEmpty())
return null;
String a=telephone.toString();
a=a.replace('[',' ');
return a.replace(']',' ');
}
/**
* Renvoie tous les numéros de téléphone
* @return String[des numéros]
*
*/
public String getAllTelephoneEtType(){
if(telephone.isEmpty())
return null;
StringBuffer a=new StringBuffer();
for(int i=0;i<telephone.size();i++){
a.append("["+this.tyTel.get(i)+"] "+this.telephone.get(i)+", ");
}
a.delete(a.length()-2,a.length());
return a.toString();
}
/**
* Renvois le type d eetelepehone
*/
public String gettytelephone (int numtel){
return tyTel.elementAt(numtel);
}
/**
* renvois le fax
* numfax = numéro de fax (0=1fax)
*/
public String getfax ( int numfax){
return fax.elementAt(numfax);
}
/**
* renvois le fax
* numfax = numéro de fax (0=1fax)
*/
public String getAllFax (){
if (fax.isEmpty())
return null;
String a= fax.toString();
a=a.replace('[',' ');
return a.replace(']',' ');
}
/**
* renvois le fax
* numfax = numéro de fax (0=1fax)
*/
public String getAllFaxEtType (){
if (fax.isEmpty())
return null;
StringBuffer a=new StringBuffer();
for(int i=0;i<fax.size();i++){
a.append("["+this.tyFax.get(i)+"] "+this.fax.get(i)+", ");
}
a.delete(a.length()-2,a.length());
return a.toString();
}
/**
* renvois le type de fax
* numfax = numéro du fax 0=1 fax
* @return String
*/
public String gettypefax(int numfax){
return tyFax.elementAt(numfax);
}
/**
* Renvois le mail
* numfax = numéro du mail (0=1mail)
* @return string
*/
public String getmail( int numMail){
return mail.elementAt(numMail);
}
/**
* Renvois le mail
* numfax = numéro du mail (0=1mail)
* @return string
*/
public String getAllMail(){
if (mail.isEmpty())
return null;
String a=mail.toString();
a=a.replace('[',' ');
return a.replace(']',' ');
}
/**
* Renvois les mails et leur type
* numfax = numéro du mail (0=1mail)
* @return string
*/
public String getAllMailEtType(){
if (mail.isEmpty())
return null;
StringBuffer a=new StringBuffer();
for(int i=0;i<mail.size();i++){
a.append("["+this.tyMail.get(i)+"] "+this.mail.get(i)+", ");
}
a.delete(a.length()-2,a.length());
return a.toString();
}
/**
* Retourne le type de l'email
* nummail = mumério du mail
* @return un string
*/
public String gettymail(int numMail){
return tyMail.elementAt(numMail);
}
/**
* Retourne le site web
* numweb= le numéro du site web
*/
public String getweb( int numweb){
return web.elementAt(numweb);
}
/**
* Retourne tous les sites web
* numweb= le numéro du site web
*/
public String getAllWeb(){
if (web.isEmpty())
return null;
String a=web.toString();
a=a.replace('[',' ');
return a.replace(']',' ');
}
/**
* Retourne tout les sites web et leur type
* numweb= le numéro du site web
*/
public String getAllWebEtType(){
if (web.isEmpty())
return null;
StringBuffer a=new StringBuffer();
for(int i=0;i<web.size();i++){
a.append("["+this.tyWeb.get(i)+"] "+this.web.get(i)+", ");
}
a.delete(a.length()-2,a.length());
return a.toString();
}
/**
* Retourne le Type du site web
* @see #getweb(int)
*/
public String gettyweb( int numweb){
return tyWeb.elementAt(numweb);
}
/**
* Ajouter un enfant
* @param idEnfant numéro d'ordre de l'enfant.
*/
public void addenfant(int idEnfant){
enf.add(idEnfant);
}
/**
* Ajouter un conjoint.
* @param idConjoint
*/
public void addconjoint(int idConjoint){
conj.add(idConjoint);
}
/**
* Permets d'ajouter un conjoint.
* @param typeConjoint
*/
public void addconjty(String typeConjoint){
conjty.add(typeConjoint);
}
/**
* Permet de modifier un conjoint
* @param numero noméro du conjoint a modifié
* @param type type de conjoint pas le quelle on remplace d'ocrence précédente.
*/
public void modifierTypConj(int numero,String type){
conjty.set(numero,type);
}
/**
* Permet de modifier un conjoint
* @param id noméro du conjoint a modifié
* @param type type de conjoint pas le quelle on remplace d'occurrence précédente.
*/
public void modifierTypConjID(int id,String type){
int numero=conj.indexOf(id);
conjty.set(numero,type);
}
/**
* Donne l'identificateur de la personne
* @return id identificateur (pas le numéro d'ordre !!!)
*/
public String getid(){
return id;
}
/**
* Enregistre le numéro d'ordre du père
* @param idpere numéro d'ordre !!!
*/
public void setpere(int idpere){
this.idPere=idpere;
}
/**
* Enregistre le numéro d'ordre de la mère
* @param idmere Numéro d'ordre.
*/
public void setmere(int idmere){
this.idMere=idmere;
}
/**
* Associe une photo à la personne.
* @param img fichier contenent le photo
*/
public void setPhoto(File img){
this.photo=img;
}
/**
* Création d'une nouvelle entrée: on appelle Qperso,
* on enregistre les données dans la classe (ici, perso)
* et on ferme la class Qperso.
* Fmain = frame parent
*/
public boolean nouvEntree (String idcree,Frame Fmain,String nom1 ){
this.id=idcree;
Qperso personne =new Qperso(Fmain,nom1); //Crée la boîte de dialogue avec les questions.
Fmain=null;
//Récupérons les informations :
if (personne.iserror())
{return false;}
update(personne);
personne.dispose();//on détruit la class personne (Qperso).
return true;
}
/**
* Mets toutes les variables d'instance propre (c'est à dire concernant uniquement la personne)
* à jour. l'id, les enf , les conj .. ne sont pas modifié.
*/
public void update (Qperso personne){
nom=personne.getnom();
prenom=personne.getprenom();
if (!personne.gettitre().isEmpty()) titre=personne.gettitre();
njour=personne.getNJour();
nmois=personne.getNMois();
nan=personne.getNan();
lieuxn=personne.getLeuxN();
deces=personne.getmort();
mjour=personne.getjourM();
mmoi=personne.getmoisM();
man=personne.getanM();
lieuxM=personne.getLieuxM();
sex=personne.getsexe();
telephone=personne.gettel();
tyTel=personne.gettytel();
adresse=personne.getadrs();
tyAdresse=personne.gettyadr();
fax=personne.getfax();
tyFax=personne.gettyfax();
mail=personne.getMail();
tyMail=personne.gettyMail();
web=personne.getWeb();
tyWeb=personne.gettyWeb();
if (!personne.getnote().isEmpty()) note=personne.getnote();
if (!personne.getBiog().isEmpty()) biographie=personne.getBiog();
photo=personne.getphoto();
}
/**
* Donne un tableau d'objet contenant les informations de la class. selon la
* convention suivante : [26]
nom
prenom
titre
njour
nmois
nan
lieuxn
deces
mjour
mmoi
man
lieuxM
sex
telephone
tyTel
adresse
tyAdresse
fax
tyFax
mail
tyMail
web
tyWeb
note
biographie
photo
* @return un talbeau d'objet de la class
*/
public Object[] tabl(){
Object[] tab=new Object[26];
tab[0]=nom;
tab[1]=prenom;
tab[2]=titre;
tab[3]=njour;
tab[4]=nmois;
tab[5]=nan;
tab[6]=lieuxn;
tab[7]=deces;
tab[8]=mjour;
tab[9]=mmoi;
tab[10]=man;
tab[11]=lieuxM;
tab[12]=sex;
tab[13]=telephone;
tab[14]=tyTel;
tab[15]=adresse;
tab[16]=tyAdresse;
tab[17]=fax;
tab[18]=tyFax;
tab[19]=mail;
tab[20]=tyMail;
tab[21]=web;
tab[22]=tyWeb;
tab[23]=note;
tab[24]=biographie;
tab[25]=photo;
return tab;
}
/**
* Donne le nom et le prénom de la personne.
* par exemple "Marie Dupond"
* @return une chaîne contenant le nom est le prénom
*/
public String getnetp(){
String a="";
if (nom!=null)
a=nom;
if (prenom!=null)
a=a+" "+prenom;
a.trim();
return a;
}
/**
* supprime le conjoint donne
* @param numero conjoint à suprimer
*/
public void removeConj(int numero){
conj.remove(numero) ;
}
/**
* Supprime l'enfant donné
* @param numero enfant à supprimer.
*/
public void removeEnf(int numero){
enf.remove(numero);
}
public void setId(String ident){
this.id=ident;
}
/**
* true ssi il existe des num
* @return
*/
public boolean isTel(){
return !this.telephone.isEmpty();
}
/**
* true ssi il existe des site web
* @return
*/
public boolean isweb(){
return !this.web.isEmpty();
}
/**
* true ssi il existe des fax
* @return
*/
public boolean isFax(){
return !this.fax.isEmpty();
}
/**
* true ssi il existe des adrs
* @return
*/
public boolean isAdrs(){
return !this.adresse.isEmpty();
}
/**
* true ssi il existe des -mail
* @return
*/
public boolean isMail(){
return !this.mail.isEmpty();
}
} |
Partager