Java Reference
In-Depth Information
figure C.2
Packing bits for
faculty profiles
// Faculty Profile Fields
1
static int SEX = 0x0001; // On if female
2
static int MINORITY = 0x0002; // On if in a minority group
3
static int VETERAN = 0x0004; // On if veteran
4
static int DISABLED = 0x0008; // On if disabled
5
static int US_CITIZEN = 0x0010; // On if citizen
6
static int DOCTORATE = 0x0020; // On if holds a doctorate
7
static int TENURED = 0x0040; // On if tenured
8
static int TWELVE_MON = 0x0080; // On if 12 month contract
9
static int VISITOR = 0x0100; // On if visiting faculty
10
static int CAMPUS = 0x0200; // On if at main campus
11
12
13
static int RANK = 0x0c00; // 2 bits to represent rank
static int ASSISTANT = 0x0400; // Assistant Professor
14
static int ASSOCIATE = 0x0800; // Associate Professor
15
static int FULL = 0x0c00; // Full Professor
16
17
18
static int COLLEGE = 0xf000; // Represents 16 colleges
...
19
static int ART_SCIENCE = 0x3000; // Arts & Science: College 3
20
21
...
22
23 // Later in a method initialize appropriate fields
24 tim = ART_SCIENCE | ASSOCIATE | CAMPUS | TENURED |
25 TWELVE_MON | DOCTORATE | US_CITIZEN;
26
27
// Promote tim To Full Professor
tim &= ~RANK; // Turn all rank fields off
28
tim |= FULL; // Turn rank fields on
29
 
Search WWH ::




Custom Search