public class LifeCycle{public static void main(String args[]) {
Session session = new Session();
List boys = new ArrayList();
boys = session.getBoys();
Girl noush = new Girl();
while (noush.isSingle()) {
List noushFans = new ArrayList();
for (Iterator iterator = boys.iterator() ; iterator.hasNext);) {
Boy boy = iterator.next();
if (boy.isNoushFan())
noushFans.add(boy);
}
int counter = 0;
boolean found = false;
for (int i=0 ; i < noushFans.size(); i++) {
counter++;
NoushFan noushFan = noushFans.get(i);
if (noushFan.hasAllConditions() && noush.like(noushFan)) {
try{
noush.doLike(noushFan);
found = true;
break;
} catch (Exception e) {
throw new Exception("Exception is occured! try again...");
}
}
}
if (counter == noushFans.size() && !found) {
Session session = new Session();
boys = session.getBoys();
continue;
} else {
if (noushFan.hasAllCondistions() && noush.love(noushFan)) {
BoyFriend bf = (BoyFriend) noushFan;
try{
noush.doLove(bf);
if (bf.hasAllSpecialConditions()) {
SpecialPerson x = (SpecialPerson) bf;
noush.liveForever(x);
break;
} else {
Session session = new Session();
boys = session.getBoys();
continue;
}
} catch (Exception e) {
throw new Exception("Exception is occured! try again...");
}
}
}
}
}
}
you are a great programmer dear Noush
ReplyDeleteTnxXx DoOostam :*
ReplyDelete