|
1 " |
|
2 COPYRIGHT (c) 2003 by eXept Software AG |
|
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 "{ Package: 'stx:libbasic' }" |
|
13 |
|
14 "{ NameSpace: Smalltalk }" |
|
15 |
|
16 AbstractNumberVector subclass:#UnboxedIntegerArray |
|
17 instanceVariableNames:'' |
|
18 classVariableNames:'' |
|
19 poolDictionaries:'' |
|
20 category:'Collections-Arrayed' |
|
21 ! |
|
22 |
|
23 !UnboxedIntegerArray class methodsFor:'documentation'! |
|
24 |
|
25 copyright |
|
26 " |
|
27 COPYRIGHT (c) 2003 by eXept Software AG |
|
28 All Rights Reserved |
|
29 |
|
30 This software is furnished under a license and may be used |
|
31 only in accordance with the terms of that license and with the |
|
32 inclusion of the above copyright notice. This software may not |
|
33 be provided or otherwise made available to, or used by, any |
|
34 other person. No title to or ownership of the software is |
|
35 hereby transferred. |
|
36 " |
|
37 ! |
|
38 |
|
39 documentation |
|
40 " |
|
41 An abstract superclass for all unboxed integer classes. |
|
42 In contrast to normal arrays (which store pointers to their elements), |
|
43 unboxedIntegerArrays store the values in a dense & compact way. |
|
44 Since the representation fits corresponding underlying C-language representations, |
|
45 these are also useful to pass bulk data to c primitive code. |
|
46 |
|
47 [see also:] |
|
48 ByteArray WordArray BooleanArray FloatArray DoubleArray Array |
|
49 IntegerArray LongIntegerArray SignedLongIntegerArray |
|
50 |
|
51 [author:] |
|
52 Claus Gittinger |
|
53 " |
|
54 ! ! |
|
55 |
|
56 !UnboxedIntegerArray class methodsFor:'queries'! |
|
57 |
|
58 isAbstract |
|
59 "Return if this class is an abstract class. |
|
60 True is returned for UnboxedIntegerArray here; false for subclasses. |
|
61 Abstract subclasses must redefine this again." |
|
62 |
|
63 ^ self == UnboxedIntegerArray |
|
64 ! |
|
65 |
|
66 maxVal |
|
67 "the maximum value which can be stored in instances of me" |
|
68 |
|
69 ^ self subclassResponsibility. |
|
70 ! |
|
71 |
|
72 minVal |
|
73 "the minimum value which can be stored in instances of me" |
|
74 |
|
75 ^ self subclassResponsibility. |
|
76 ! ! |
|
77 |
|
78 !UnboxedIntegerArray methodsFor:'printing'! |
|
79 |
|
80 printOn:aStream base:radix showRadix:showRadix |
|
81 "append a printed representation to aStream in the given number base." |
|
82 |
|
83 (self class == WordArray or:[self class == LongIntegerArray]) |
|
84 ifTrue:[ "/ care for subclasses |
|
85 aStream nextPutAll:'#('. |
|
86 self |
|
87 do:[:word | word printOn:aStream base:radix showRadix:showRadix] |
|
88 separatedBy:[aStream space]. |
|
89 aStream nextPut:$). |
|
90 ^ self |
|
91 ]. |
|
92 ^ self printOn:aStream |
|
93 ! ! |
|
94 |
|
95 !UnboxedIntegerArray methodsFor:'queries'! |
|
96 |
|
97 defaultElement |
|
98 ^ 0 |
|
99 ! |
|
100 |
|
101 isValidElement:anObject |
|
102 "return true, if I can hold this kind of object" |
|
103 |
|
104 ^ anObject isInteger |
|
105 and:[ (anObject >= self class minVal) |
|
106 and:[ (anObject <= self class maxVal) ]] |
|
107 ! ! |
|
108 |
|
109 !UnboxedIntegerArray class methodsFor:'documentation'! |
|
110 |
|
111 version |
|
112 ^ '$Header$' |
|
113 ! |
|
114 |
|
115 version_CVS |
|
116 ^ '$Header$' |
|
117 ! ! |
|
118 |