Example #1
0
 public static ArrayList<Message> findOutgoingMessage(Port port, String name, boolean fuzzy) {
   ArrayList<Message> result = new ArrayList<Message>();
   for (Message t : port.getSends()) {
     if (t.getName().startsWith(name)) {
       if (fuzzy) result.add(t);
       else if (t.getName().equals(name)) result.add(t);
     }
   }
   return result;
 }
Example #2
0
 public static ArrayList<Message> findMessage(Thing thing, String name, boolean fuzzy) {
   ArrayList<Message> result = new ArrayList<Message>();
   for (Message msg : allMessages(thing)) {
     if (msg.getName().startsWith(name)) {
       if (fuzzy) result.add(msg);
       else if (msg.getName().equals(name)) result.add(msg);
     }
   }
   return result;
 }
Example #3
0
 @Override
 public void onPreDispose(Message<?, ?, ?> message) {
   log(
       Level.INFO,
       String.format("%s %s is about to be disposed", message.getName(), modeStatus),
       showStackTrace ? new StackTrace() : null);
 }
Example #4
0
 @Override
 public void onRateChanged(Message<?, ?, ?> message, double oldRate, double newRate) {
   log(
       Level.INFO,
       String.format(
           "rate for %s %s change from %f to %f", message.getName(), modeStatus, oldRate, newRate),
       showStackTrace ? new StackTrace() : null);
 }
Example #5
0
 /**
  * if this method return null the message is rejected and should be dumped.
  *
  * @param currentMessage
  * @return
  */
 public final Message setCurrentMessage(Message currentMessage) {
   this.currentMessage = currentMessage;
   if (!controller.isControlling(currentMessage.getSender())
       && !SYS_TERMINATION_MESSAGE.equals(currentMessage.getName())) {
     messageCount[controller.pid()]++;
   }
   return beforeMessageProcessing(currentMessage);
 }
Example #6
0
 @Override
 public void isScheduledChanged(boolean isScheduled) {
   log(
       Level.INFO,
       String.format(
           "schedule status for %s has changed to %s. Env time is %d",
           message.getName(), modeStatus, isScheduled ? "scheduled" : "not scheduled"),
       showStackTrace ? new StackTrace() : null);
 }
Example #7
0
 @Override
 public void onChange(DataType oldtype, DataType newType, Message<?, ?, ?> message) {
   log(
       Level.INFO,
       String.format(
           "MemType for %s %s has changed from %s to %s",
           message.getName(), modeStatus, oldtype.name(), newType.name()),
       showStackTrace ? new StackTrace() : null);
 }
Example #8
0
 /** Mark a message as read. */
 public static void markAsRead(User user, Message message) throws IOException {
   markAsRead(user, message.getName());
 }