com.perisic.shadow.example.shadows
Class CalamityShadow

java.lang.Object
  extended by com.perisic.shadow.Shadow
      extended by 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);
        }
    }


Constructor Summary
CalamityShadow()
           
 
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 com.perisic.shadow.Shadow
shadowOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalamityShadow

public CalamityShadow()
Method Detail

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.