Clover coverage report - Drools - 2.0-rc2
Coverage timestamp: Wed May 11 2005 07:12:26 BST
file stats: LOC: 270   Methods: 0
NCLOC: 36   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
WorkingMemory.java - - - -
coverage
 1    package org.drools;
 2   
 3    /*
 4    * $Id: WorkingMemory.java,v 1.43.2.1 2005/05/10 12:11:24 mproctor Exp $
 5    *
 6    * Copyright 2001-2004 (C) The Werken Company. All Rights Reserved.
 7    *
 8    * Redistribution and use of this software and associated documentation
 9    * ("Software"), with or without modification, are permitted provided that the
 10    * following conditions are met:
 11    *
 12    * 1. Redistributions of source code must retain copyright statements and
 13    * notices. Redistributions must also contain a copy of this document.
 14    *
 15    * 2. Redistributions in binary form must reproduce the above copyright notice,
 16    * this list of conditions and the following disclaimer in the documentation
 17    * and/or other materials provided with the distribution.
 18    *
 19    * 3. The name "drools" must not be used to endorse or promote products derived
 20    * from this Software without prior written permission of The Werken Company.
 21    * For written permission, please contact bob@werken.com.
 22    *
 23    * 4. Products derived from this Software may not be called "drools" nor may
 24    * "drools" appear in their names without prior written permission of The Werken
 25    * Company. "drools" is a registered trademark of The Werken Company.
 26    *
 27    * 5. Due credit should be given to The Werken Company.
 28    * (http://drools.werken.com/).
 29    *
 30    * THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS ``AS IS''
 31    * AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 32    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 33    * ARE DISCLAIMED. IN NO EVENT SHALL THE WERKEN COMPANY OR ITS CONTRIBUTORS BE
 34    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 35    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 36    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 37    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 38    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 39    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 40    * POSSIBILITY OF SUCH DAMAGE.
 41    *
 42    */
 43   
 44    import java.io.Serializable;
 45    import java.util.List;
 46    import java.util.Map;
 47   
 48    import org.drools.event.WorkingMemoryEventListener;
 49    import org.drools.spi.AgendaFilter;
 50    import org.drools.spi.AsyncExceptionHandler;
 51   
 52    /**
 53    * A knowledge session for a <code>RuleBase</code>.
 54    *
 55    * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter </a>
 56    * @author <a href="mailto:mproctor@codehaus.org"> mark proctor </a>
 57    *
 58    */
 59    public interface WorkingMemory
 60    extends
 61    Serializable
 62    {
 63    /**
 64    * Add an event listener.
 65    *
 66    * @param listener
 67    * The listener to add.
 68    */
 69    void addEventListener(WorkingMemoryEventListener listener);
 70   
 71    /**
 72    * Remove an event listener.
 73    *
 74    * @param listener
 75    * The listener to remove.
 76    */
 77    void removeEventListener(WorkingMemoryEventListener listener);
 78   
 79    /**
 80    * Returns all event listeners.
 81    *
 82    * @return listeners The listeners.
 83    */
 84    List getEventListeners();
 85   
 86    /**
 87    * Retrieve all of the set application data in this memory
 88    *
 89    * @return the application data as a Map
 90    */
 91    Map getApplicationDataMap();
 92   
 93    /**
 94    * Set a specific piece of application data in this working memory
 95    *
 96    * @param name
 97    * the name under which to populate the data
 98    * @param value
 99    * the application data
 100    */
 101    void setApplicationData(String name,
 102    Object value);
 103   
 104    /**
 105    * Retrieve a specific piece of application data by name
 106    *
 107    * @return application data or null if nothing is set under this name
 108    */
 109    Object getApplicationData(String name);
 110   
 111    /**
 112    * Retrieve the <code>RuleBase</code> for this working memory.
 113    *
 114    * @return The <code>RuleBase</code>.
 115    */
 116    RuleBase getRuleBase();
 117   
 118    /**
 119    * Fire all items on the <code>Agenda</code> until empty.
 120    *
 121    * @throws FactException
 122    * If an error occurs.
 123    */
 124    void fireAllRules() throws FactException;
 125   
 126    /**
 127    * Fire all items on the <code>Agenda</code> until empty, using the given <code>AgendaFilter</code>
 128    *
 129    * @see AgendaFilter
 130    *
 131    * @throws FactException
 132    * If an error occurs.
 133    */
 134    void fireAllRules(AgendaFilter agendaFilter) throws FactException;
 135   
 136    /**
 137    * Retrieve the object associated with a <code>FactHandle</code>.
 138    *
 139    * @see #containsObject
 140    *
 141    * @param handle
 142    * The fact handle.
 143    *
 144    * @return The associated object.
 145    *
 146    * @throws NoSuchFactObjectException
 147    * If no object is known to be associated with the specified handle.
 148    */
 149    Object getObject(FactHandle handle) throws NoSuchFactObjectException;
 150   
 151    /**
 152    * Retrieve the <code>FactHandle</code> associated with an Object.
 153    *
 154    * @see #containsObject
 155    *
 156    * @param object
 157    * The object.
 158    *
 159    * @return The associated fact handle.
 160    *
 161    * @throws NoSuchFactHandleException
 162    * If no handle is known to be associated with the specified object.
 163    */
 164    FactHandle getFactHandle(Object object) throws NoSuchFactHandleException;
 165   
 166    /**
 167    * Retrieve all known objects.
 168    *
 169    * @return The list of all known objects.
 170    */
 171    List getObjects();
 172   
 173    /**
 174    * Retrieve all known objects of the specified class.
 175    *
 176    * @param objectClass
 177    * The class of object to return.
 178    *
 179    * @return The list of all known objects of the specified class.
 180    */
 181    List getObjects(Class objectClass);
 182   
 183    /**
 184    * Retrieve all known Fact Handles.
 185    *
 186    * @return The list of all known fact handles.
 187    */
 188    List getFactHandles();
 189   
 190    /**
 191    * Determine if an object is associated with a <code>FactHandle</code>.
 192    *
 193    * @param handle
 194    * The fact handle.
 195    *
 196    * @return <code>true</code> if an object is known to be associated with
 197    * the specified handle, otherwise <code>false</code>.
 198    */
 199    boolean containsObject(FactHandle handle);
 200   
 201    /**
 202    * Assert a fact.
 203    *
 204    * @param object
 205    * The fact object.
 206    *
 207    * @return The new fact-handle associated with the object.
 208    *
 209    * @throws FactException
 210    * If an error occurs.
 211    */
 212    FactHandle assertObject(Object object) throws FactException;
 213   
 214    /**
 215    * Assert a fact registering JavaBean <code>PropertyChangeListeners</code>
 216    * on the Object to automatically trigger <code>modifyObject</code> calls
 217    * if <code>dynamic</code> is <code>true</code>.
 218    *
 219    * @param object
 220    * The fact object.
 221    * @param dynamic
 222    * true if Drools should add JavaBean
 223    * <code>PropertyChangeListeners</code> to the object.
 224    *
 225    * @return The new fact-handle associated with the object.
 226    *
 227    * @throws FactException
 228    * If an error occurs.
 229    */
 230    FactHandle assertObject(Object object,
 231    boolean dynamic) throws FactException;
 232   
 233    /**
 234    * Retract a fact.
 235    *
 236    * @param handle
 237    * The fact-handle associated with the fact to retract.
 238    *
 239    * @throws FactException
 240    * If an error occurs.
 241    */
 242    void retractObject(FactHandle handle) throws FactException;
 243   
 244    /**
 245    * Modify a fact.
 246    *
 247    * @param handle
 248    * The fact-handle associated with the fact to modify.
 249    * @param object
 250    * The new value of the fact.
 251    *
 252    * @throws FactException
 253    * If an error occurs.
 254    */
 255    void modifyObject(FactHandle handle,
 256    Object object) throws FactException;
 257   
 258    /**
 259    * Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda
 260    * Scheduler used for duration rules.
 261    * @param handler
 262    */
 263    void setAsyncExceptionHandler(AsyncExceptionHandler handler);
 264   
 265    /**
 266    * Clear the Agenda
 267    *
 268    */
 269    void clearAgenda();
 270    }