首 页 | 模 板 | 学 院 | 源 码 | 书 籍 | 壁 纸 | 字 体 | JS脚本 | FLASH源码 | 软 件 | 矢 量 | 服务器软件 | 素 材 | 其 它 |
设为主页
加入收藏
联系站长
平面设计 | 网页制作 | 程序编写 | 数 据 库 | 媒体动画 | 网络冲浪 | 服务器相关 | 站长乐园 | 业界动态 |
当前在线
实用:JAVA事件模式下PHP如何实现
2006-11-29 16:42:41  作者:模板天下收集整理  来源:未知 网友评论 0 条 论坛
  

/***
* This method is invoked by a ProtocolCommandEvent source after
* sending a protocol command to a server.
*
* @param event The ProtocolCommandEvent fired.
***/
public void protocolCommandSent(ProtocolCommandEvent event);

/***
* This method is invoked by a ProtocolCommandEvent source after
* receiving a reply from a server.
*
* @param event The ProtocolCommandEvent fired.
***/
public void protocolReplyReceived(ProtocolCommandEvent event);

}

本文的最后一个文件是ProtocolCommandEvent.java。这个文件包含了一个EventObject 类中的叫做ProtocolCommandEvent的子集。EventObject的子集用于通过从event producer到event listeners的事件数据。ProtocolCommandEvent 类增加了一个定义在EventObject中的getSource()方法,创建了creates the getMessage(), isReply(), isCommand(), getReplyCode() and getCommand()方法。这些方法只能返回给类一个只读字段,只能在构造函数中设置。
ProtocolCommandEvent.java
public class ProtocolCommandEvent extends EventObject {

private int __replyCode;
private boolean __isCommand;
private String __message, __command;

public ProtocolCommandEvent(Object source, String command, String message) {
super(source);
__replyCode = 0;
__message = message;
__isCommand = true;
__command = command;
}

public ProtocolCommandEvent(Object source, int replyCode, String message) {
super(source);
__replyCode = replyCode;
__message = message;
__isCommand = false;
__command = null;
}

public String getCommand() { return __command; }
public int getReplyCode() { return __replyCode; }
public boolean isCommand() { return __isCommand; }
public boolean isReply() { return !isCommand(); }
public String getMessage() { return __message; }

}

共分4页  [1] [2] [3] [4] 

>> 相关文章

关于网站 | 客服中心 | 服务条款 | 友情链接 | 广告联系 | 本站历程 | 网站导航

吉ICP备05000107号