Java Communicating Agents是一个用于开发网络反应式信息agent的框架

源代码在线查看: message.java

软件大小: 422 K
上传用户: csytml
关键词: Communicating Agents agent Java
下载地址: 免注册下载 普通下载 VIP

相关代码

				/*				 * $Source: /home/data/cvsroot/src/jacomma/icm/type/Message.java,v $				 * $Revision: 1.6 $				 * $Date: 2000/10/28 20:09:07 $				 *				 * This file is part of the jacomma framework				 * Copyright (c) 2000 	Dimitrios Vyzovitis				 *			mailto:dviz@egnatia.ee.auth.gr				 *							 *				 *							 *							 *							 *				 *	This library is free software; you can redistribute it and/or modify				 *	it under the terms of the GNU Library General Public License as published by				 *	the Free Software Foundation; either version 2 of the License, or				 *	(at your option) any later version.				 *				 *	This library 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 Library General Public License for more details.				 *				 *	You should have received a copy of the GNU Library General Public License				 *	along with this library; if not, write to the Free Software				 *	Foundation, Inc., 59 Temple Place, Suite 330, 				 *	Boston, MA  02111-1307  USA				 */								package jacomma.icm.type;								/**				 * TBA				 **/				public class Message implements Cloneable {										Object cnt_;					Handle snd_;					Handle rcv_;					MessageOptions opt_;										int hc_;									public Message( Handle from, Handle to, Object cnt ) {						this( from, to, cnt, MessageOptions.defaults() );					}									public Message( Handle from, Handle to, Object cnt, MessageOptions opt  ) {						snd_ = from;						rcv_ = to;						cnt_ = cnt;						opt_ = opt;												hc_ = snd_.hashCode() ^ rcv_.hashCode() ^ cnt_.hashCode() ^ opt_.hashCode();					}										public boolean equals( Object obj ) {						try {							return snd_.equals( ((Message)obj).snd_ )								&& rcv_.equals( ((Message)obj).rcv_ )								&& opt_.equals( ((Message)obj).opt_ );						} catch ( ClassCastException exc ) {							return false;						}					}										public int hashCode() {						return hc_;					}										public Object getContent() { return cnt_; }					public Handle getSender() { return snd_; }					public Handle getRecipient() { return rcv_; }					public MessageOptions getOptions() { return opt_; }										public Handle replyto() {						Handle to = (Handle)opt_.get( MessageOptions.icmReplyTo );						return (to == null) ? snd_ : to;					}									public Message createReply( Handle from, Object cnt ) {						Handle to = replyto();						MessageOptions opt = (MessageOptions)opt_.clone();						opt.clear( MessageOptions.icmReplyTo );						return new Message( from, to, cnt, opt );					}									public Message createReply( Handle from, Object cnt, MessageOptions opt ) {						Handle to = replyto();						return new Message( from, to, cnt, opt );					}									public Message createReply( Object cnt ) {						Handle to = replyto();						MessageOptions opt = (MessageOptions)opt_.clone();						opt.clear( MessageOptions.icmReplyTo );						return new Message( rcv_, to, cnt, opt );					}									public Message createReply( Object cnt, MessageOptions opt ) {						Handle to = replyto();						return new Message( rcv_, to, cnt, opt );					}										public Message createForward( Handle to ) {						return new Message( rcv_, to, this );					}									public Message createForward( Handle to, MessageOptions opt ) {						return new Message( rcv_, to, this, opt );					}										public Message createTransparentForward( Handle to ) {						return new Message( rcv_, to, cnt_ );					}									public Message createTransparentForward( Handle to, MessageOptions opt ) {						return new Message( rcv_, to, cnt_, opt );					}										public String toString() {						return "(" + rcv_ + "," + snd_ + "," + opt_ + "," + cnt_ + ")";					}									public Object clone() {						try {							return super.clone();						} catch ( CloneNotSupportedException exc ) {							throw new jacomma.util.CheckedException( exc );						}					}											}							

相关资源