From efdf505f3ebe01c8e536a263343f10cd3b90c917 Mon Sep 17 00:00:00 2001 From: Tony Grosinger Date: Thu, 15 Sep 2011 15:58:18 -0700 Subject: [PATCH] -Created and implemented ObjectReferenceOutdated Exception Signed-off-by: Tony Grosinger --- bin/net/grosinger/nomads/TownHall.class | Bin 2059 -> 2185 bytes .../exceptions/ObjectReferenceOutdated.class | Bin 0 -> 462 bytes src/net/grosinger/nomads/TownHall.java | 21 +++++++++--------- .../exceptions/ObjectReferenceOutdated.java | 8 +++++++ 4 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 bin/net/grosinger/nomads/exceptions/ObjectReferenceOutdated.class create mode 100644 src/net/grosinger/nomads/exceptions/ObjectReferenceOutdated.java diff --git a/bin/net/grosinger/nomads/TownHall.class b/bin/net/grosinger/nomads/TownHall.class index 51f691cf53bb7e75d8ef324a8145c94bb6fb5050..a4358124f4f046ab25f4b4b5bb5972026c5b8e86 100644 GIT binary patch delta 804 zcmY+B$xl;Z6vcnvd#^kwPYP-o$~?%}$|#5vih@>|6%a(Bln2ycAy5)ou{I8gc^mr| zuoX3rL=(ZdbD@8VYmL(_H70KEH{5&fIrrShxsUR4KmB_99%v(GqA5xprAl{0Pt-Am zx9?%pUQ5JQ;~OT$iZ03dgZ97A=HdDKb~G_&FWT#NJZcYbCKe(Id%=tJu_&Y5`KT)M zDlPovd#UDxNsXe)+4WR;ENZE9O0>?*Y8osWX>z8u){GF%CMTWeTD9IntFx!It9E%6 z1_xK;_SQ&j#rBHUQx=_cDKeMr#6)Ce(^ly94Ph_coHaR<0yx`Rmh?Txd4(?)kFML1 z4ZAn85)q*aqdwd)kwp)eOfD*lQ`&%Nx$<&FIU%`uX>@ne%Q3a z$Sw;rU@@4Y&l39H)y;Tf%S(u1ixEbhu+df$;-GODHa~D z$!y+tjBjL_f{!pS*#Ep@Tz-@Q18J{vWcajA(UOr1S+dKgyuy6xv?!tw^t^b8_>&B(V*VIaG&YW{+zM1*vJLjqISyR)e-|s&F{VWK##E$iz>Jmk6B(QAMW!{Z`uPw8Ad8)1-@-^}vyFM>uG5h`9C2 z(dS9fV~|vYtZ#ZqKq(GeN*mDARaZ4Xr`5%J={Ff*P~l!Gl=BNK>ji}t@1F3I;i$op zJ#gCTks8B{STD4I>o_M3PFTBIL>uLl^+ij2#yD$mMrc=S$7YMAl|_?r+7!N}!djuU zP%h+(YlV%O<&}cLxxKm%^}1x136l#|5*{HjR$N~zZ+J;CX_8|~;VKnYi%*1DEN=O< zXiIm#8l5q@M2EsyemuVVsJvl)*0=PVim>%k4_mLD!|pNenA~OI?N_I!HU$aFfdi*# zKA*7JUtuosj-X9=vbG<{Z84hEY`UjXAL*?SNbS;V)0feE{JPE18;;qW-oh{8Y=wp% ziDzxjODLJLxtO$>uKd~Ekq#POu_H8yZNb>2l}6gcw#yfgyX=sw3X&!yQimB8PnM|6 z)J0wpw~13Hse?7TnAFQ(BU4=Fiad{2L0{#Xj1!UkJhRd;E%EEJbmj!xhVvKg1_^`A zPf9U^8@?at-*HL$Eotyi5vHYt68OHFA`LQPO^o?%wJrYI91XHVpJ>=mGeiHVnYFzC Q)T%8tRI@nm$Y5Pf@zxp+pS33e817cD#xBuGRM(dsZ@Li)|!7&lyY!`@!>Z&?Wz{s4cJ zIOhjeHa0W!hPU(HzPI<6R{+Q8h6n`uhI~A8w$NrqE;e?dvLdF(l$KswQ^dpRoKk;F zcjU;VG%S6lJY^y30^PYdHs9)NQnphXO7~ktc+RuaX zK@~D}RNa!=NF|q!R@#<@^rd5LcwIPoint Will return null if the NeighborBuilding was * created in a previous turn. + * + * @throws ObjectReferenceOutdated */ - public Point requestNewObjective() { + public Point requestNewObjective() throws ObjectReferenceOutdated { if (verifyObjectValidity()) { return Nomads.awesomeWorld.generateObjective(drone); } else { - // Object not valid, do nothing - return null; + throw new ObjectReferenceOutdated(); } } } diff --git a/src/net/grosinger/nomads/exceptions/ObjectReferenceOutdated.java b/src/net/grosinger/nomads/exceptions/ObjectReferenceOutdated.java new file mode 100644 index 0000000..10e60eb --- /dev/null +++ b/src/net/grosinger/nomads/exceptions/ObjectReferenceOutdated.java @@ -0,0 +1,8 @@ +package net.grosinger.nomads.exceptions; + +public class ObjectReferenceOutdated extends Exception { + + public ObjectReferenceOutdated() { + super("This object was created in a previous turn and is no longer valid"); + } +}