com.perisic.shadow.example.shadows
Class CalamityShadow
java.lang.Object
com.perisic.shadow.Shadow
com.perisic.shadow.example.shadows.CalamityShadow
- public class CalamityShadow
- extends Shadow
An example shadow that brings calamity over the shadowed objects. For conveninence
the uncommented source code:
public class CalamityShadow extends com.perisic.shadow.Shadow {
public void tellCalamityTo(NiceFellow other) {
System.out.println((String) shadowOwner().call("getName")+" says: Oj, oj!");
other.call("cry");
}
public void cry() {
System.out.println(shadowOwner().call("getName").toString()+" cries.");
shadowOwner().call("setHappyness",(Integer) shadowOwner().call("getHappyness") - 1);
}
}
- First version: 16.03.2004
-
Copyright: (c) Marc Conrad, 2004
-
See http://perisic.com/shadow for information about this package.
- The com.perisic.shadow library is distributed under the terms of the
GNU Lesser General Public License (LGPL).
- If you require the package under a different licence please contact me.
- disclaimer: The classes are provided "as is".
There is no warranty implied by using the com.perisic.shadow package.
- Note: This class needs Java 1.5 for succesfull compilation. Compile this
class with the command javac -source 1.5
Method Summary |
void |
cry()
The happyness of this object is decreased by one. |
void |
tellCalamityTo(NiceFellow other)
Tells a calamity to other and makes other cry. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CalamityShadow
public CalamityShadow()
tellCalamityTo
public void tellCalamityTo(NiceFellow other)
- Tells a calamity to other and makes other cry.
- Parameters:
other
- The nice fellow who gets the calamity told.
cry
public void cry()
- The happyness of this object is decreased by one.