home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 August / PCO0897.ISO / filesbbs / os2 / fp1os2.arj / OS2 / DATA / 49 / C / 0 / F_26836 / SJMessage.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-05-15  |  2.8 KB  |  98 lines

  1. public class SJMessage {
  2.    private int nMessageID;
  3.    private SJMessageHandlerInterface aNotifyObj;
  4.    private SJMessageHandlerInterface aCallbackObj;
  5.    private Object[] aObjArray;
  6.    public static final int ID_EMPTY = 0;
  7.    public static final int ID_NOTIFY_MESSAGE_DONE = 10000;
  8.    public static final int ID_NOTIFY_MESSAGE_RECEIVED = 10001;
  9.    public static final int ID_NOTIFY_MESSAGE_ERROR = 10002;
  10.    public static final int ID_NOTIFY_JOB_FINISHED = 10011;
  11.    public static final int ID_NOTIFY_JOB_KILLED = 10012;
  12.    public static final int ID_DATA_FOR_JOB_FINISHED = 10013;
  13.    public static final int ID_NOTIFY_THREAD_STARTED = 10021;
  14.    public static final int ID_NOTIFY_THREAD_SUSPENDED = 10022;
  15.    public static final int ID_NOTIFY_THREAD_STOPED = 10023;
  16.    public static final int ID_PING = 10030;
  17.    public static final int ID_NOTIFY_PING = 10031;
  18.  
  19.    public final void JOB_SetNotifyObject(SJMessageHandlerInterface var1) {
  20.       this.aNotifyObj = var1;
  21.    }
  22.  
  23.    private final SJMessageHandlerInterface GetNotifyObject() {
  24.       return this.aNotifyObj;
  25.    }
  26.  
  27.    public SJMessage() {
  28.       this(0);
  29.    }
  30.  
  31.    public SJMessage(int var1) {
  32.       this(var1, (SJMessageHandlerInterface)null, (Object)null);
  33.    }
  34.  
  35.    public SJMessage(int var1, SJMessageHandlerInterface var2) {
  36.       this.nMessageID = var1;
  37.       this.aCallbackObj = var2;
  38.       this.aObjArray = null;
  39.    }
  40.  
  41.    public SJMessage(int var1, SJMessageHandlerInterface var2, Object var3) {
  42.       this(var1, var2);
  43.       this.aObjArray = new Object[1];
  44.       this.SetObject(0, var3);
  45.    }
  46.  
  47.    public final int GetID() {
  48.       return this.nMessageID;
  49.    }
  50.  
  51.    public final int GetNoOfObjects() {
  52.       return this.aObjArray == null ? 0 : this.aObjArray.length;
  53.    }
  54.  
  55.    public final void SetNoOfObjects(int var1) {
  56.       this.aObjArray = new Object[var1];
  57.    }
  58.  
  59.    public final void SetObject(int var1, Object var2) {
  60.       this.aObjArray[var1] = var2;
  61.    }
  62.  
  63.    public final Object GetObject(int var1) {
  64.       return this.aObjArray == null ? null : this.aObjArray[var1];
  65.    }
  66.  
  67.    public final void PostToCallback(SJMessage var1) {
  68.       if (this.aCallbackObj != null) {
  69.          this.aCallbackObj.HandleMessage(var1);
  70.       } else {
  71.          System.out.println("PostToCallback() without aCallbackObj, MsgID=" + this.GetID());
  72.       }
  73.    }
  74.  
  75.    public final void PostToNotify(SJMessage var1) {
  76.       if (this.aNotifyObj != null) {
  77.          this.aNotifyObj.HandleMessage(var1);
  78.       }
  79.  
  80.    }
  81.  
  82.    public final void Acknowledge() {
  83.       this.PostToNotify(new SJMessage(10000, (SJMessageHandlerInterface)null, this));
  84.    }
  85.  
  86.    public final void AcknowledgeError() {
  87.       this.PostToNotify(new SJMessage(10002, (SJMessageHandlerInterface)null, this));
  88.    }
  89.  
  90.    public final void JobFinished() {
  91.       this.PostToNotify(new SJMessage(10011, (SJMessageHandlerInterface)null, this));
  92.    }
  93.  
  94.    public final void AcknowledgePing() {
  95.       this.PostToNotify(new SJMessage(10031, (SJMessageHandlerInterface)null, this));
  96.    }
  97. }
  98.