移动Agent编程工具Naplet

源代码在线查看: message.java

软件大小: 969 K
上传用户: ABC258369000
关键词: Naplet Agent 移动 编程工具
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				/*
				 * @Message.java 0.0.1, 1/1/2000
				 *
				 * THIS PROGRAM IS FREE SOFTWARE; YOU CAN DISTRIBUTED IT AND/OR
				 * MODIFY IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE 
				 * AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION.
				 *
				 * THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
				 * BUT WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
				 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE 
				 * GNU GENERAL PUBLIC LICENSE FOR MORE DETAILS.
				 *
				 * Copyright (c) 2000 Cheng-Zhong Xu. All Rights Reserved.
				 */
				
				package naplet.message;
				
				import naplet.*;
				
				/**
				 * The Message class provides a wrapped message 
				 * with an inclusion of sender and receiver identifiers.
				 *
				 * @version 0.0.1, 1/1/2000
				 * @author C. Xu
				 */
				
				public class Message implements java.io.Serializable {
					public static final int USER = 0;
					public static final int TERMINATE = 1;
					public static final int TERMINATE_ACK = 2;
					public static final int SUSPEND = 3;
					public static final int SUSPEND_ACK = 4;
					public static final int RESUME = 5;
					public static final int RESUME_ACK = 6;
					public static final int RESTART = 7;
					public static final int RESTART_ACK = 8;
					
					private NapletID sender;
					private NapletID receiver;
					private int type;
					private String message;
					
					/**
					 * Constructor. Default message type is USER
					 * @param sendID NapletID of sender
					 * @param recvID NapletID of receiver
					 * @param msg	 Context of message
					 */ 
					public Message( NapletID sendID, NapletID recvID, String msg) {
						this(USER, sendID, recvID, msg);
					}
					
					/**
					 * Constructor
					 * @param type   Message type, MessageType.SYSTEM or USER
					 * @param sendID NapletID of sender
					 * @param recvID NapletID of receiver
					 * @param msg	 Context of message
					 */ 
					public Message( int type, NapletID sendID, NapletID recvID, String msg) {
					    this.type = type;
					    sender = sendID;
						receiver = recvID;
						message = msg;
					}
				
					public NapletID getSender() {return sender;}
					public NapletID getReceiver() {return receiver;}
					public String getMessage() { return message; }
					public int getType() { return type; }
				}
				
							

相关资源