001    package com.hammurapi.reasoning.spi;
002    
003    import java.lang.annotation.ElementType;
004    import java.lang.annotation.Retention;
005    import java.lang.annotation.RetentionPolicy;
006    import java.lang.annotation.Target;
007    
008    /**
009     * This annotation is used 
010     * to indicate that method is a filter method for a multi-fact inference
011     * method. The purpose of this annotation is similar to Override annotation,
012     * i.e. it ensures that accept methods are properly bound to rules container
013     * inference infrastructure. This annotation is checked at runtime after 
014     * rule instantiation, as opposed to compile-time check of Override.
015     * @author Pavel
016     * TODO Multi-parameter accept methods for partial joins.
017     */
018    @Target(ElementType.METHOD)
019    @Retention(RetentionPolicy.RUNTIME)
020    public @interface Accept {
021            
022            /**
023             * @return Inference method name, this accept method is for.
024             * If not specified, this accept method will be invoked for all
025             * infer methods with matching parameters.
026             */
027            String method() default "";
028            
029            /**
030             * @return Parameter types of inference method.
031             */
032            Class<?>[] parameterTypes() default {};
033            
034            /**
035             * @return Positions of parameters which this method is attached to.
036             * It is used for multi-parameter accept methods.
037             */
038            int[] parameterPositions() default -1;
039            
040            /**
041             * Cost of accept condition evaluation. This cost can be used by rule compilation/execution engine to optimize condition order. 
042             * @return
043             */
044            double cost() default 1.0;      
045            
046    }