UndefinedObject.st
changeset 1 a27a279701f8
child 2 6526dde5f3ac
equal deleted inserted replaced
0:aa2498ef6470 1:a27a279701f8
       
     1 "
       
     2  COPYRIGHT (c) 1988-92 by Claus Gittinger
       
     3 	      All Rights Reserved
       
     4 
       
     5  This software is furnished under a license and may be used
       
     6  only in accordance with the terms of that license and with the
       
     7  inclusion of the above copyright notice.   This software may not
       
     8  be provided or otherwise made available to, or used by, any
       
     9  other person.  No title to or ownership of the software is
       
    10  hereby transferred.
       
    11 "
       
    12 
       
    13 Object subclass:#UndefinedObject
       
    14        instanceVariableNames:''
       
    15        classVariableNames:''
       
    16        poolDictionaries:''
       
    17        category:'Kernel-Objects'
       
    18 !
       
    19 
       
    20 UndefinedObject comment:'
       
    21 
       
    22 COPYRIGHT (c) 1988-92 by Claus Gittinger
       
    23 	      All Rights Reserved
       
    24 
       
    25 there is only one instance of this class: nil
       
    26 
       
    27 %W% %E%
       
    28 '!
       
    29 
       
    30 !UndefinedObject class methodsFor:'instance creation'!
       
    31 
       
    32 basicNew
       
    33     "catch new - there MUST be only one nil in the system"
       
    34 
       
    35     ^ nil
       
    36 !
       
    37 
       
    38 basicNew:size
       
    39     "catch new - there MUST be only one nil in the system"
       
    40 
       
    41     ^ nil
       
    42 ! !
       
    43 
       
    44 !UndefinedObject methodsFor:'error catching'!
       
    45 
       
    46 basicAt:index
       
    47     "catch array access - its illegal
       
    48      defined here since basicAt: in Object ommits the nil-check"
       
    49 
       
    50     ^ self notIndexed
       
    51 !
       
    52 
       
    53 at:index
       
    54     "catch array access - its illegal
       
    55      defined here since at: in Object ommits the nil-check"
       
    56 
       
    57     ^ self notIndexed
       
    58 !
       
    59 
       
    60 basicAt:index put:anObject
       
    61     "catch array access - its illegal
       
    62      defined here since basicAt:put: in Object ommits the nil-check"
       
    63 
       
    64     ^ self notIndexed
       
    65 !
       
    66 
       
    67 at:index put:anObject
       
    68     "catch array access - its illegal
       
    69      defined here since at:put: in Object ommits the nil-check"
       
    70 
       
    71     ^ self notIndexed
       
    72 ! !
       
    73 
       
    74 !UndefinedObject methodsFor:'testing'!
       
    75 
       
    76 isNil
       
    77     "return true if I am nil - since I am, return true"
       
    78 
       
    79     ^ true
       
    80 !
       
    81 
       
    82 notNil
       
    83     "return true if I am not nil - since I am nil, return false"
       
    84 
       
    85     ^ false
       
    86 !
       
    87 
       
    88 size
       
    89     "return the number of indexed instvars
       
    90      defined here since size in Object ommits the nil-check"
       
    91  
       
    92     ^ 0
       
    93 !
       
    94 
       
    95 basicSize
       
    96     "return the number of indexed instvars
       
    97      defined here since size in Object ommits the nil-check"
       
    98 
       
    99     ^ 0
       
   100 !
       
   101 
       
   102 hash
       
   103     "return an integer useful as a hash key"
       
   104 
       
   105     ^ 0
       
   106 !
       
   107 
       
   108 identityHash
       
   109     "return an integer useful as a hash key"
       
   110 
       
   111     ^ 0
       
   112 ! !
       
   113 
       
   114 !UndefinedObject methodsFor:'copying'!
       
   115 
       
   116 shallowCopy
       
   117     "return a shallow copy of myself
       
   118      - since there is only one nil in the system return self"
       
   119 
       
   120     ^ self
       
   121 !
       
   122 
       
   123 deepCopy
       
   124     "return a deep copy of myself
       
   125      - since there is only one nil in the system return self"
       
   126 
       
   127     ^ self
       
   128 ! !
       
   129 
       
   130 !UndefinedObject methodsFor:'printing & storing'!
       
   131 
       
   132 printString
       
   133     "return a string for printing myself"
       
   134 
       
   135     ^ 'nil'
       
   136 !
       
   137 
       
   138 storeString
       
   139     "return a string for storing myself"
       
   140 
       
   141     ^ 'nil'
       
   142 ! !