601
|
1 |
"
|
736
|
2 |
COPYRIGHT (c) 1997 by eXept Software AG
|
601
|
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 |
|
1177
|
13 |
"{ Package: 'stx:libbasic2' }"
|
|
14 |
|
|
15 |
UnboxedIntegerArray variableLongSubclass:#IntegerArray
|
601
|
16 |
instanceVariableNames:''
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Collections-Arrayed'
|
|
20 |
!
|
|
21 |
|
|
22 |
!IntegerArray class methodsFor:'documentation'!
|
|
23 |
|
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 1997 by eXept Software AG
|
|
27 |
All Rights Reserved
|
|
28 |
|
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
!
|
|
37 |
|
|
38 |
documentation
|
|
39 |
"
|
|
40 |
IntegerArrays store integers in the range 0..16rFFFFFFFF.
|
|
41 |
In contrast to normal arrays (which store pointers to their elements),
|
|
42 |
integerArrays store the values in a dense & compact way.
|
|
43 |
Since the representation fits the underlying C-language systems representation
|
|
44 |
of unsigned int32's, this is also useful to pass bulk data to c primitive code.
|
|
45 |
|
736
|
46 |
[memory requirements:]
|
|
47 |
OBJ-HEADER + (size * 4)
|
|
48 |
|
601
|
49 |
[see also:]
|
736
|
50 |
ByteArray BooleanArray FloatArray DoubleArray Array
|
|
51 |
SignedWordArray WordArray
|
601
|
52 |
|
|
53 |
[author:]
|
736
|
54 |
Claus Gittinger
|
601
|
55 |
"
|
|
56 |
! !
|
|
57 |
|
1445
|
58 |
!IntegerArray methodsFor:'comparing'!
|
|
59 |
|
|
60 |
< anIntegerArray
|
|
61 |
"Compare the receiver with the argument and return true if the
|
|
62 |
receiver is greater than the argument. Otherwise return false.
|
|
63 |
|
|
64 |
Redefined for speed (xpath handling)"
|
|
65 |
|
|
66 |
%{ /* NOCONTEXT */
|
|
67 |
|
|
68 |
int len1, len2, min, i;
|
|
69 |
REGISTER OBJ s = anIntegerArray;
|
|
70 |
unsigned int *ip1, *ip2;
|
|
71 |
OBJ cls;
|
|
72 |
OBJ myCls;
|
|
73 |
|
|
74 |
if (__isNonNilObject(s)) {
|
|
75 |
cls = __qClass(s);
|
|
76 |
myCls = __qClass(self);
|
|
77 |
|
|
78 |
if ((cls == IntegerArray) || (cls == myCls)) {
|
|
79 |
ip2 = __integerArrayVal(s);
|
|
80 |
len2 = __integerArraySize(s);
|
|
81 |
/*
|
|
82 |
* care for instances of subclasses ...
|
|
83 |
*/
|
|
84 |
if (cls != IntegerArray) {
|
|
85 |
int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)) / sizeof(__integerArrayVal(s));
|
|
86 |
|
|
87 |
ip2 += n;
|
|
88 |
len2 -= n;
|
|
89 |
}
|
|
90 |
|
|
91 |
ip1 = __integerArrayVal(self);
|
|
92 |
len1 = __integerArraySize(self);
|
|
93 |
/*
|
|
94 |
* care for instances of subclasses ...
|
|
95 |
*/
|
|
96 |
if (myCls != IntegerArray) {
|
|
97 |
int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(myCls)->c_ninstvars)) / sizeof(__integerArrayVal(s));
|
|
98 |
|
|
99 |
ip1 += n;
|
|
100 |
len1 -= n;
|
|
101 |
}
|
|
102 |
|
|
103 |
if (len1 <= len2)
|
|
104 |
min = len1;
|
|
105 |
else
|
|
106 |
min = len2;
|
|
107 |
|
|
108 |
for (i = 0; i < min; i++) {
|
|
109 |
if (ip1[i] < ip2[i]) {
|
|
110 |
RETURN(true)
|
|
111 |
}
|
|
112 |
if (ip1[i] > ip2[i]) {
|
|
113 |
RETURN(false)
|
|
114 |
}
|
|
115 |
}
|
|
116 |
|
|
117 |
if (len1 < len2) {
|
|
118 |
RETURN ( true );
|
|
119 |
}
|
|
120 |
RETURN ( false );
|
|
121 |
}
|
|
122 |
}
|
|
123 |
%}.
|
|
124 |
^ super < anIntegerArray
|
|
125 |
|
|
126 |
|
|
127 |
"
|
|
128 |
(IntegerArray newFrom:#[1 2 3 4 5]) < (IntegerArray newFrom:#[1 2 3 4 5])
|
|
129 |
(IntegerArray newFrom:#[1 2 3 4 5]) < (IntegerArray newFrom:#[1 2 3 4])
|
|
130 |
(IntegerArray newFrom:#[1 2 3 4]) < (IntegerArray newFrom:#[1 2 3 4 5])
|
|
131 |
(IntegerArray newFrom:#[1 2 3 4 5]) < (IntegerArray newFrom:#[1 2 3 4 6])
|
|
132 |
(IntegerArray newFrom:#[]) < (IntegerArray newFrom:#[1 2 3 4 6])
|
|
133 |
"
|
|
134 |
! !
|
|
135 |
|
601
|
136 |
!IntegerArray class methodsFor:'documentation'!
|
|
137 |
|
|
138 |
version
|
1445
|
139 |
^ '$Header: /cvs/stx/stx/libbasic2/IntegerArray.st,v 1.4 2004-04-12 16:37:53 stefan Exp $'
|
601
|
140 |
! !
|