Clover coverage report - Drools - 2.0-rc2
Coverage timestamp: Wed May 11 2005 07:12:26 BST
file stats: LOC: 147   Methods: 9
NCLOC: 56   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
FactHandleImpl.java 100% 100% 100% 100%
coverage
 1    package org.drools.reteoo;
 2   
 3    /*
 4    * $Id: FactHandleImpl.java,v 1.19.2.2 2005/05/10 12:11:25 mproctor Exp $
 5    *
 6    * Copyright 2001-2003 (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 trademark of The Werken Company.
 26    *
 27    * 5. Due credit should be given to The Werken Company. (http://werken.com/)
 28    *
 29    * THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS ``AS IS''
 30    * AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 31    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 32    * ARE DISCLAIMED. IN NO EVENT SHALL THE WERKEN COMPANY OR ITS CONTRIBUTORS BE
 33    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 34    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 35    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 36    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 37    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 38    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 39    * POSSIBILITY OF SUCH DAMAGE.
 40    *
 41    */
 42   
 43    import org.drools.FactHandle;
 44   
 45    /**
 46    * Implementation of <code>FactHandle</code>.
 47    *
 48    * @author <a href="mailto:bob@werken.com">bob mcwhirter </a>
 49    * @author <a href="mailto:mproctor@codehaus.org"> mark proctor </a>
 50    *
 51    */
 52    public class FactHandleImpl
 53    implements
 54    FactHandle
 55    {
 56    // ----------------------------------------------------------------------
 57    // Instance members
 58    // ----------------------------------------------------------------------
 59   
 60    /** Handle id. */
 61    private long id;
 62    private final long recency;
 63   
 64    // ----------------------------------------------------------------------
 65    // Constructors
 66    // ----------------------------------------------------------------------
 67   
 68  23 protected FactHandleImpl(long id)
 69    {
 70  23 this.id = id;
 71  23 this.recency = id;
 72    }
 73   
 74    /**
 75    * Construct.
 76    *
 77    * @param id
 78    * Handle id.
 79    */
 80  872 protected FactHandleImpl(long id,
 81    long recency)
 82    {
 83  872 this.id = id;
 84  872 this.recency = recency;
 85    }
 86   
 87    // ----------------------------------------------------------------------
 88    // Instance members
 89    // ----------------------------------------------------------------------
 90   
 91    /**
 92    * @see Object
 93    */
 94  30628 public boolean equals( Object object )
 95    {
 96  30628 if ( this == object )
 97    {
 98  7030 return true;
 99    }
 100   
 101  23598 if ( object == null || ! ( object instanceof FactHandle ) )
 102    {
 103  3570 return false;
 104    }
 105   
 106  20028 return this.id == ( ( FactHandleImpl ) object ).id;
 107    }
 108   
 109    /**
 110    * @see Object
 111    */
 112  48746 public int hashCode()
 113    {
 114  48746 return (int) this.id;
 115    }
 116   
 117    /**
 118    * @see FactHandle
 119    */
 120  16 public String toExternalForm()
 121    {
 122  16 return "[fid:" + this.id + "]";
 123    }
 124   
 125    /**
 126    * @see Object
 127    */
 128  16 public String toString()
 129    {
 130  16 return toExternalForm( );
 131    }
 132   
 133  110948 public long getRecency()
 134    {
 135  110948 return this.recency;
 136    }
 137   
 138  86298 public long getId()
 139    {
 140  86298 return this.id;
 141    }
 142   
 143  54 void invalidate()
 144    {
 145  54 this.id = -1;
 146    }
 147    }