1 package Jt.examples.patterns; 2 import java.util.*; 3 import java.lang.reflect.*; 4 import java.beans.*; 5 import java.io.*; 6 import Jt.*; 7 8 9 10 13 14 15 public class OffSwitch extends JtState { 16 17 18 19 public OffSwitch () { 20 } 21 22 23 24 25 31 32 public Object processMessage (Object event) { 33 34 String msgid = null; 35 JtMessage e = (JtMessage) event; 36 Object content; 37 Object data; 38 JtMessage aux; 39 40 41 if (e == null) 42 return null; 43 44 msgid = (String ) e.getMsgId (); 45 46 if (msgid == null) 47 return null; 48 49 content = e.getMsgContent(); 50 51 if (msgid.equals ("JtREMOVE")) { 52 return (this); 53 } 54 55 if (msgid.equals ("JtSWITCH_VALUE")) { 56 return ("Off"); 57 } 58 handleError ("processMessage: invalid message id:" + msgid); 59 return (null); 60 61 } 62 63 64 } 65 | Popular Tags |