Coverage Report - net.wotonomy.control.EONullValue
 
Classes in this File Line Coverage Branch Coverage Complexity
EONullValue
0% 
0% 
1.8
 
 1  
 /*
 2  
 Wotonomy: OpenStep design patterns for pure Java applications.
 3  
 Copyright (C) 2001 Intersect Software Corporation
 4  
 
 5  
 This library is free software; you can redistribute it and/or
 6  
 modify it under the terms of the GNU Lesser General Public
 7  
 License as published by the Free Software Foundation; either
 8  
 version 2.1 of the License, or (at your option) any later version.
 9  
 
 10  
 This library is distributed in the hope that it will be useful,
 11  
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13  
 Lesser General Public License for more details.
 14  
 
 15  
 You should have received a copy of the GNU Lesser General Public
 16  
 License along with this library; if not, see http://www.gnu.org
 17  
 */
 18  
 
 19  
 package net.wotonomy.control;
 20  
 
 21  
 import java.io.Serializable;
 22  
 
 23  
 import net.wotonomy.foundation.NSNull;
 24  
 
 25  
 /**
 26  
 * EONullValue is used to represent null in Collections classes
 27  
 * because List and Map do not specify whether null values
 28  
 * are allowed and because NSArray and NSDictionary explicitly
 29  
 * do not allow null values. <br><br>
 30  
 *
 31  
 * Use of the static singleton method nullValue() is required 
 32  
 * by this implementation because Java cannot return a singleton
 33  
 * instance from a constructor. <br><br>
 34  
 *
 35  
 * This implementation duplicates NSNull, but the singleton instances
 36  
 * are of course different.  Be careful.  I have no idea why this
 37  
 * class was even created, given that NSNull exists.
 38  
 *
 39  
 * @author michael@mpowers.net
 40  
 * @author $Author: cgruber $
 41  
 * @version $Revision: 894 $
 42  
 */
 43  0
 public class EONullValue implements Serializable
 44  
 {
 45  0
     private static final EONullValue instance = new EONullValue();
 46  
     
 47  
     /**
 48  
     * Create a new instance of EONullValue.
 49  
     */
 50  0
     private EONullValue ()
 51  0
     {
 52  0
     }
 53  
 
 54  
     /**
 55  
     * Constructor specifying name and object.
 56  
     */
 57  
     public static EONullValue nullValue ()
 58  
     {        
 59  0
         return instance; 
 60  
     }
 61  
 
 62  
     /**
 63  
     * Returns a human-readable string representation.
 64  
     */
 65  
     public String toString()
 66  
     {
 67  0
         return "[null]";
 68  
     }
 69  
     
 70  
     /**
 71  
     * Hashcode of all instances is zero.
 72  
     */
 73  
     public int hashCode()
 74  
     {
 75  0
         return 0;   
 76  
     }
 77  
     
 78  
     /**
 79  
     * Implemented to return true for any instance of EONullValue
 80  
     * and for any instance of NSNull.
 81  
     */
 82  
     public boolean equals( Object anObject )
 83  
     {
 84  0
         if ( anObject instanceof EONullValue ) return true;
 85  0
         if ( anObject instanceof NSNull ) return true;
 86  0
         return false;
 87  
     }
 88  
 }
 89  
 
 90  
 /*
 91  
  * $Log$
 92  
  * Revision 1.2  2006/02/16 16:47:14  cgruber
 93  
  * Move some classes in to "internal" packages and re-work imports, etc.
 94  
  *
 95  
  * Also use UnsupportedOperationExceptions where appropriate, instead of WotonomyExceptions.
 96  
  *
 97  
  * Revision 1.1  2006/02/16 13:19:57  cgruber
 98  
  * Check in all sources in eclipse-friendly maven-enabled packages.
 99  
  *
 100  
  * Revision 1.3  2003/08/06 23:07:52  chochos
 101  
  * general code cleanup (mostly, removing unused imports)
 102  
  *
 103  
  * Revision 1.2  2001/03/01 20:35:38  mpowers
 104  
  * Implemented equals and hashCode.
 105  
  *
 106  
  * Revision 1.1  2001/02/26 22:41:51  mpowers
 107  
  * Implemented null placeholder classes.
 108  
  * Duplicator now uses NSNull.
 109  
  * No longer catching base exception class.
 110  
  *
 111  
  *
 112  
  */
 113