home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 2.1 KB | 101 lines |
- // Fac.java
- // 15.03.96
- //
- // The faculte field in a manifestation
-
- package cybcerone.manif;
-
- import cybcerone.utils.Manif;
-
- /**
- * Manif's (events) are sponsored by one of these faculties.
- */
- class Fac {
- static final int ALL = 0;
- static final int THEOLOGIE = 1;
- static final int DROIT = 2;
- static final int LETTRES = 3;
- static final int SSP = 4;
- static final int HEC = 5;
- static final int SCIENCES = 6;
- static final int MEDECINE = 7;
- static final int SERVICES = 8;
- static final int AUTRES = 9;
-
- private int code;
-
- Fac (int code) {
- this.code = code;
- }
-
- Fac (String facName) {
- this (decode (facName));
- }
-
- public int getFac () { return code; }
-
- private static int decode (String facName) {
- facName = facName.toUpperCase ();
-
- if (facName.startsWith ("THE")) return (1);
- else if (facName.startsWith ("DRO")) return (2);
- else if (facName.startsWith ("LET")) return (3);
- else if (facName.startsWith ("S.S")) return (4);
- else if (facName.startsWith ("H.E")) return (5);
- else if (facName.startsWith ("SCI")) return (6);
- else if (facName.startsWith ("MED")) return (7);
- else if (facName.startsWith ("SER")) return (8);
- else if (facName.startsWith ("AUT")) return (9);
- else return (0);
- }
-
- /** returns true if this fac includes this manifestation */
- boolean includes (Manif theManif) {
- if (code == ALL)
- return true;
- else
- return (code == decode (theManif.getFaculte ()));
- }
-
- public String toString () {
- String theCode;
-
- switch (code) {
- case 0:
- theCode = "ALL";
- break;
- case 1:
- theCode = "THE";
- break;
- case 2:
- theCode = "DRO";
- break;
- case 3:
- theCode = "LET";
- break;
- case 4:
- theCode = "SSP";
- break;
- case 5:
- theCode = "HEC";
- break;
- case 6:
- theCode = "SCI";
- break;
- case 7:
- theCode = "MED";
- break;
- case 8:
- theCode = "SER";
- break;
- case 9:
- theCode = "AUT";
- break;
- default:
- theCode = "UNKNOWN";
- }
-
- return ("Fac[" + theCode + "]");
- }
- }
-