cours0708/G5a/Solutions/3-exosClasses-1/2-AdherentGerant/Pack_adherents/Gerant.java

135 lines
2.9 KiB
Java

/** Java class "Gerant.java" generated from Poseidon for UML.
* Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
* Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
*/
package Pack_adherents;
import java.util.*;
/**
* <p>
*
* </p>
*/
class Gerant {
///////////////////////////////////////
// attributes
/**
* <p>
*
* </p>
*/
public static Collection adherent = new Vector();
///////////////////////////////////////
// operations
/**
* <p>
* Does ...
* </p><p>
*
* </p><p>
*
*
*
* @param args ...
* </p>
*/
public static void main(String[] args) {
Adherent a1=new Adherent(1,"Dupont","Paris",1980);
addAdherent(a1);
Adherent a2=new Adherent(2,"Meyer","Strasbourg",1955);
addAdherent(a2);
Adherent a3=new Adherent(3,"Legwenn","Brest",1960);
addAdherent(a3);
for (int i=0;i<adherent.size();i++){
Vector v=(Vector)getAdherents();
Adherent a=(Adherent)v.elementAt(i);
System.out.println (a);
}
System.out.println ();
a1.cotiser(45);
for (int i=0;i<adherent.size();i++){
Vector v=(Vector)getAdherents();
Adherent a=(Adherent)v.elementAt(i);
System.out.println (a);
}
System.out.println ();
a2.cotiser(30);
for (int i=0;i<adherent.size();i++){
Vector v=(Vector)getAdherents();
Adherent a=(Adherent)v.elementAt(i);
System.out.println (a);
}
System.out.println ();
a3.cotiser(40);
for (int i=0;i<adherent.size();i++){
Vector v=(Vector)getAdherents();
Adherent a=(Adherent)v.elementAt(i);
System.out.println (a);
}
System.out.println ();
a2.cotiser(15);
for (int i=0;i<adherent.size();i++){
Vector v=(Vector)getAdherents();
Adherent a=(Adherent)v.elementAt(i);
System.out.println (a);
}
} // end main
/**
* <p>
* Does ...
* </p><p>
*
* @return a Collection with ...
* </p>
*/
public static Collection getAdherents() {
return adherent;
} // end getAdherents
/**
* <p>
* Does ...
* </p><p>
*
* </p><p>
*
* @param adherent ...
* </p>
*/
public static void addAdherent(Adherent adherent) {
if (! Gerant.adherent.contains(adherent)) Gerant.adherent.add(adherent);
} // end addAdherent
/**
* <p>
* Does ...
* </p><p>
*
* </p><p>
*
* @param adherent ...
* </p>
*/
public static void removeAdherent(Adherent adherent) {
Gerant.adherent.remove(adherent);
} // end removeAdherent
} // end Gerant