/** Delete subscriber */
 public boolean deregister(Subscription sub) throws FailureException {
   for (Subscriber subs : subscribers) {
     if (subs.getSub().equals(sub)) {
       subscribers.remove(new Subscriber(subs.getSub(), subs.getType(), subs.getDate()));
     }
   }
   //
   System.out.println(
       "Agent "
           + buildingcs.getAID().getName()
           + " deregistered the agent "
           + sub.getMessage().getSender().getName());
   return false;
 }
 /** Tick action */
 public void tick() {
   if (this.subscribers.size() > 0) {
     for (Subscriber sub : this.subscribers) {
       // Check subscription date
       Date now = new Date();
       if (sub.getDate().after(now)) {
         this.notify(sub);
       } else {
         this.subscribers.remove(sub);
         break;
       }
     }
   }
 }
 /** Notify the subscriber */
 private void notify(Subscriber subscriber) {
   try {
     Subscription subscription = subscriber.getSub();
     ACLMessage notification = subscription.getMessage().createReply();
     notification.setPerformative(ACLMessage.INFORM); // New message
     // Create context
     SendSubscriptionMessage smsg = this.buildingcs.getNotifyMessage(subscriber);
     this.buildingcs.getContentManager().fillContent(notification, smsg);
     subscription.notify(notification); // Send message
   } catch (Exception e) {
     e.printStackTrace();
   }
 }