topicutility.java
来自「java实现的P2P多agent中间件」· Java 代码 · 共 24 行
JAVA
24 行
package jade.core.messaging;
import jade.core.AID;
/**
* This class embeds topic related utility methods that must be available in MIDP
*/
public class TopicUtility {
public static final AID createTopic(String topicName) {
return new AID(topicName+'@'+TopicManagementHelper.TOPIC_SUFFIX, AID.ISGUID);
}
public static final boolean isTopic(AID id) {
// NOTE that checking the endsWith() condition is much faster as it does not involve extracting
// the HAP from the AID --> Whenever an AID is not a topic we immediately detect that
if (id.getName().endsWith(TopicManagementHelper.TOPIC_SUFFIX)) {
return TopicManagementHelper.TOPIC_SUFFIX.equals(id.getHap());
}
else {
return false;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?