home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / gnusmalltalk / true.st < prev    next >
Text File  |  1992-02-15  |  2KB  |  111 lines

  1. "======================================================================
  2. |
  3. |   True Method Definitions
  4. |
  5.  ======================================================================"
  6.  
  7.  
  8. "======================================================================
  9. |
  10. | Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
  11. | Written by Steve Byrne.
  12. |
  13. | This file is part of GNU Smalltalk.
  14. |
  15. | GNU Smalltalk is free software; you can redistribute it and/or modify it
  16. | under the terms of the GNU General Public License as published by the Free
  17. | Software Foundation; either version 1, or (at your option) any later version.
  18. | GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
  19. | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  20. | FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
  21. | details.
  22. | You should have received a copy of the GNU General Public License along with
  23. | GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
  24. | Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
  25. |
  26.  ======================================================================"
  27.  
  28.  
  29. "
  30. |     Change Log
  31. | ============================================================================
  32. | Author       Date       Change 
  33. | sbb         16 Mar 91      Class creation now separate statement.
  34. |
  35. | sbb         22 Sep 90      Changed printOn: to reflect new String printOn: (so
  36. |              we can't use it any more).
  37. |
  38. | sbyrne     19 Sep 89      Changed to use real method categories.
  39. |
  40. | sbyrne     25 Apr 89      created.
  41. |
  42. "
  43.  
  44. Boolean subclass: #True
  45.     instanceVariableNames: 'truthValue'
  46.     classVariableNames: ''
  47.     poolDictionaries: ''
  48.     category: nil
  49. !
  50.  
  51. True comment: 
  52. 'I represent truth and justice in the world.  My motto is "semper veritatis".'
  53. !
  54.  
  55.  
  56. !True methodsFor: 'basic'!
  57.  
  58. ifTrue: trueBlock ifFalse: falseBlock
  59.     ^trueBlock value
  60. !
  61.  
  62. ifFalse: falseBlock ifTrue: trueBlock
  63.     ^trueBlock value
  64. !
  65.  
  66. ifTrue: trueBlock
  67.     ^trueBlock value
  68. !
  69.  
  70. ifFalse: falseBlock
  71.     ^nil
  72. !
  73.  
  74. not
  75.     ^false
  76. !
  77.  
  78. & aBoolean
  79.     ^aBoolean
  80. !
  81.  
  82. | aBoolean
  83.     ^true
  84. !
  85.  
  86. eqv: aBoolean
  87.     ^aBoolean
  88. !
  89.  
  90. xor: aBoolean
  91.     ^aBoolean not
  92. !
  93.  
  94. and: aBlock
  95.     ^aBlock value
  96. !
  97.  
  98. or: aBlock
  99.     ^true
  100. !!
  101.  
  102.  
  103.  
  104. !True methodsFor: 'printing'!
  105.  
  106. printOn: aStream
  107.     aStream nextPutAll: 'true'
  108. !!
  109.