Package jade.core.messaging

Source Code of jade.core.messaging.TopicUtility

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;
    }
  }
}
TOP

Related Classes of jade.core.messaging.TopicUtility

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.