View Javadoc
1   package org.opentrafficsim.imb.observers;
2   
3   import nl.tno.imb.TEventEntry;
4   
5   /**
6    * <p>
7    * Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
8    * BSD-style license. See <a href="http://opentrafficsim.org/node/13">OpenTrafficSim License</a>.
9    * <p>
10   * @version $Revision$, $LastChangedDate$, by $Author$,
11   *          initial version Aug 19, 2016 <br>
12   * @author <a href="http://www.tbm.tudelft.nl/averbraeck">Alexander Verbraeck</a>
13   * @author <a href="http://www.tudelft.nl/pknoppers">Peter Knoppers</a>
14   * @author <a href="http://www.transport.citg.tudelft.nl">Wouter Schakel</a>
15   */
16  public interface Observer
17  {
18      /** 
19       * Compose a message containing the specified objects and send it to recipients.
20       * @param eventName String; publication
21       * @param eventType int; one of NEW, CHANGE, or DELETE
22       * @param args Object[]; the objects to send
23       * @return boolean; true on success, false on failure
24       * @throws Exception when the event name is not a registered publication
25       */
26      boolean postMessage(String eventName, int eventType, Object[] args) throws Exception;
27      
28      /** New object was created. */
29      int NEW = TEventEntry.ACTION_NEW;
30          
31      /** The object changed state. */
32      int CHANGE = TEventEntry.ACTION_CHANGE;
33          
34      /** The object was destroyed. */
35      int DELETE = TEventEntry.ACTION_DELETE;
36          
37  }