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

  1. "======================================================================
  2. |
  3. |   ArrayedCollection 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         29 Dec 90      Removed = and hash (put them into
  36. |              SequenceableCollection).
  37. |
  38. | sbb         21 Sep 90      Removed storeOn: method; doesn't seem to be the right
  39. |              thing.
  40. |
  41. | sbyrne     25 Apr 89      created.
  42. |
  43. "
  44.  
  45. SequenceableCollection variableSubclass: #ArrayedCollection
  46.                instanceVariableNames: ''
  47.                classVariableNames: ''
  48.                poolDictionaries: ''
  49.                category: nil
  50. !
  51.  
  52. ArrayedCollection comment: 
  53. 'My instances are objects that are generally fixed size, and are accessed
  54. by an integer index.  The ordering of my instance''s elements is determined 
  55. externally; I will not rearrange the order of the elements.' !
  56.  
  57. !ArrayedCollection class methodsFor: 'instance creation'!
  58.  
  59. with: element1
  60.     | anArrayedCollection |
  61.     anArrayedCollection _ self new: 1.
  62.     anArrayedCollection at: 1 put: element1.
  63.     ^anArrayedCollection
  64. !
  65.  
  66. with: element1 with: element2
  67.     | anArrayedCollection |
  68.     anArrayedCollection _ self new: 2.
  69.     anArrayedCollection at: 1 put: element1.
  70.     anArrayedCollection at: 2 put: element2.
  71.     ^anArrayedCollection
  72. !
  73.  
  74. with: element1 with: element2 with: element3
  75.     | anArrayedCollection |
  76.     anArrayedCollection _ self new: 3.
  77.     anArrayedCollection at: 1 put: element1.
  78.     anArrayedCollection at: 2 put: element2.
  79.     anArrayedCollection at: 3 put: element3.
  80.     ^anArrayedCollection
  81. !
  82.  
  83. with: element1 with: element2 with: element3 with: element4
  84.     | anArrayedCollection |
  85.     anArrayedCollection _ self new: 4.
  86.     anArrayedCollection at: 1 put: element1.
  87.     anArrayedCollection at: 2 put: element2.
  88.     anArrayedCollection at: 3 put: element3.
  89.     anArrayedCollection at: 4 put: element4.
  90.     ^anArrayedCollection
  91. !!
  92.  
  93.  
  94.  
  95. !ArrayedCollection methodsFor: 'basic'!
  96.  
  97. add: value
  98.     self shouldNotImplement
  99. !!
  100.