001    package com.hammurapi.eventbus;
002    
003    import java.util.List;
004    
005    /**
006     * Information about how conclusion was derived.
007     * @author Pavel Vlasov
008     *
009     */
010    public interface Derivation<E, P extends Comparable<P>, C> {
011            
012            /**
013             * @return Handler which posted this event.
014             */
015            EventHandler<E, P, C, ?, ?> getHandler();
016            
017            /**
018             * @return List of handler inputs which produced this event.
019             */
020            List<E> getInputs();
021            
022            /**
023             * @param event 
024             * @return True if the parameter event is source of this derivation or derivations of
025             * one of parameter event derivations.
026             */
027            boolean isDerivedFrom(E sourceEvent);
028            
029            long timestamp();
030            
031            /**
032             * This method is invoked by event bus, not to be invoked by client code.
033             */
034            void invalidate(InferenceContext<E,P,C,?,?,?> inferenceContext);
035            
036    //      /**
037    //       * @return true if all source facts in this derivation
038    //       * are valid (has not been removed from the knowledge base).
039    //       */
040    //      boolean isValid();
041    //      
042    //      /**
043    //       * @return Length of the inference chain.
044    //       */
045    //      int getDepth();
046    //      
047    //      /**
048    //       * @return Total number of handlers fired to come to this conclusion.
049    //       */
050    //      int getCardinality();
051            
052    }