forked from stepcode/stepcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAggregationDataTypes.py
More file actions
602 lines (545 loc) · 26.9 KB
/
AggregationDataTypes.py
File metadata and controls
602 lines (545 loc) · 26.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# Copyright (c) 2011, Thomas Paviot (tpaviot@gmail.com)
# All rights reserved.
# This file is part of the StepClassLibrary (SCL).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# Neither the name of the <ORGANIZATION> nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from SimpleDataTypes import *
from TypeChecker import check_type
import BaseType
class BaseAggregate(object):
""" A class that define common properties to ARRAY, LIST, SET and BAG.
"""
def __init__( self , bound1 , bound2 , base_type ):
# check that bound1<bound2
if (bound1!=None and bound2!=None):
if bound1>bound2:
raise AssertionError("bound1 shall be less than or equal to bound2")
self._bound1 = bound1
self._bound2 = bound2
self._base_type = base_type
def __getitem__(self, index):
if index<self._bound1:
raise IndexError("ARRAY index out of bound (lower bound is %i, passed %i)"%(self._bound1,index))
elif(self._bound2!=None and index>self._bound2):
raise IndexError("ARRAY index out of bound (upper bound is %i, passed %i)"%(self._bound2,index))
else:
return list.__getitem__(self,index)
def __setitem__(self,index,value):
if index<self._bound1:
raise IndexError("ARRAY index out of bound (lower bound is %i, passed %i)"%(self._bound1,index))
elif (self._bound2!=None and index>self._bound2):
raise IndexError("ARRAY index out of bound (upper bound is %i, passed %i)"%(self._bound2,index))
elif not isinstance(value,self._base_type):
raise TypeError("%s type expected, passed %s."%(self._base_type, type(value)))
else:
# first find the length of the list, and extend it if ever
# the index is
list.__setitem__(self,index,value)
class ARRAY(BaseType.Type, BaseType.Aggregate):
"""
EXPRESS definition:
==================
An array data type has as its domain indexed, fixed-size collections of like elements. The lower
and upper bounds, which are integer-valued expressions, define the range of index values, and
thus the size of each array collection.
An array data type definition may optionally specify
that an array value cannot contain duplicate elements.
It may also specify that an array value
need not contain an element at every index position.
Given that m is the lower bound and n is the upper bound, there are exactly n-m+1 elements
in the array. These elements are indexed by subscripts from m to n, inclusive (see 12.6.1).
NOTE 1 { The bounds may be positive, negative or zero, but may not be indeterminate (?) (see
14.2).
Syntax:
165 array_type = ARRAY bound_spec OF [ OPTIONAL ] [ UNIQUE ] base_type .
176 bound_spec = '[' bound_1 ':' bound_2 ']' .
174 bound_1 = numeric_expression .
175 bound_2 = numeric_expression .
171 base_type = aggregation_types | simple_types | named_types .
Given that m is the lower bound and n is the upper bound, there are exactly n-m+1 elements
in the array. These elements are indexed by subscripts from m to n, inclusive (see 12.6.1).
NOTE 1 { The bounds may be positive, negative or zero, but may not be indeterminate (?) (see
14.2).
Rules and restrictions:
a) Both expressions in the bound specification, bound_1 and bound_2, shall evaluate to
integer values. Neither shall evaluate to the indeterminate (?) value.
b) bound_1 gives the lower bound of the array. This shall be the lowest index which is
valid for an array value of this data type.
c) bound_2 gives the upper bound of the array. This shall be the highest index which is
valid for an array value of this data type.
d) bound_1 shall be less than or equal to bound_2.
e) If the optional keyword is specified, an array value of this data type may have the
indeterminate (?) value at one or more index positions.
f) If the optional keyword is not specified, an array value of this data type shall not
contain an indeterminate (?) value at any index position.
g) If the unique keyword is specified, each element in an array value of this data type
shall be different from (i.e., not instance equal to) every other element in the same array
value.
NOTE 2 : Both optional and unique may be specified in the same array data type definition.
This does not preclude multiple indeterminate (?) values from occurring in a single array value.
This is because comparisons between indeterminate (?) values result in unknown so the uniqueness
constraint is not violated.
EXAMPLE 27 : This example shows how a multi-dimensioned array is declared.
sectors : ARRAY [ 1 : 10 ] OF -- first dimension
ARRAY [ 11 : 14 ] OF -- second dimension
UNIQUE something;
The first array has 10 elements of data type ARRAY[11:14] OF UNIQUE something. There is
a total of 40 elements of data type something in the attribute named sectors. Within each
ARRAY[11:14], no duplicates may occur; however, the same something instance may occur in two
different ARRAY[11:14] values within a single value for the attribute named sectors.
Python definition:
==================
@TODO
"""
def __init__( self , bound_1 , bound_2 , base_type , UNIQUE = False, OPTIONAL=False, scope = None):
BaseType.Type.__init__(self, base_type, scope)
if not isinstance(bound_1, int):
raise TypeError("ARRAY lower bound must be an integer")
if not isinstance(bound_2, int):
raise TypeError("ARRAY upper bound must be an integer")
if not (bound_1 <= bound_2):
raise AssertionError("ARRAY lower bound must be less than or equal to upper bound")
# set up class attributes
self._bound_1 = bound_1
self._bound_2 = bound_2
self._unique = UNIQUE
self._optional = OPTIONAL
# preallocate list elements
list_size = bound_2 - bound_1 + 1
self._container = list_size*[None]
def bound_1(self):
return self._bound_1
def bound_2(self):
return self._bound_2
def get_hiindex(self):
return INTEGER(self._bound_2)
def get_loindex(self):
return INTEGER(self._bound_1)
def get_hibound(self):
return INTEGER(self._bound_2)
def get_lobound(self):
return INTEGER(self._bound_1)
def get_size(self):
return INTEGER(self._bound_2 - self._bound_1 +1)
def get_value_unique(self):
''' Return True if all items are different in the container, UNKNOWN if some items are
indeterminate, or False otherwise'''
if None in self._container:
return Unknown
if self.get_size()-len(set(self._container))>0: #some items are repeated
return False
else:
return True
def __getitem__(self, index):
if index<self._bound_1:
raise IndexError("ARRAY index out of bound (lower bound is %i, passed %i)"%(self._bound_1,index))
elif(index>self._bound_2):
raise IndexError("ARRAY index out of bound (upper bound is %i, passed %i)"%(self._bound_2,index))
else:
value = self._container[index-self._bound_1]
if not self._optional and value is None:
raise AssertionError("Not OPTIONAL prevent the value with index %i from being None (default). Please set the value first."%index)
return value
def __setitem__(self, index, value):
if index<self._bound_1:
raise IndexError("ARRAY index out of bound (lower bound is %i, passed %i)"%(self._bound_1,index))
elif(index>self._bound_2):
raise IndexError("ARRAY index out of bound (upper bound is %i, passed %i)"%(self._bound_2,index))
else:
# first check the type of the value
check_type(value,self.get_type())
# then check if the value is already in the array
if self._unique:
if value in self._container:
raise AssertionError("UNIQUE keyword prevents inserting this instance.")
self._container[index-self._bound_1] = value
class LIST(BaseType.Type, BaseType.Aggregate):
"""
EXPRESS definition:
==================
A list data type has as its domain sequences of like elements. The optional lower and upper
bounds, which are integer-valued expressions, define the minimum and maximum number of
elements that can be held in the collection defined by a list data type.
A list data type
definition may optionally specify that a list value cannot contain duplicate elements.
Syntax:
237 list_type = LIST [ bound_spec ] OF [ UNIQUE ] base_type .
176 bound_spec = '[' bound_1 ':' bound_2 ']' .
174 bound_1 = numeric_expression .
175 bound_2 = numeric_expression .
171 base_type = aggregation_types | simple_types | named_types .
Rules and restrictions:
a) The bound_1 expression shall evaluate to an integer value greater than or equal to
zero. It gives the lower bound, which is the minimum number of elements that can be in a
list value of this data type. bound_1 shall not produce the indeterminate (?) value.
b) The bound_2 expression shall evaluate to an integer value greater than or equal to
bound_1, or an indeterminate (?) value. It gives the upper bound, which is the maximum
number of elements that can be in a list value of this data type.
If this value is indeterminate (?) the number of elements in a list value of this data type is
not bounded from above.
c) If the bound_spec is omitted, the limits are [0:?].
d) If the unique keyword is specified, each element in a list value of this data type shall
be different from (i.e., not instance equal to) every other element in the same list value.
EXAMPLE 28 { This example defines a list of arrays. The list can contain zero to ten arrays. Each
array of ten integers shall be different from all other arrays in a particular list.
complex_list : LIST[0:10] OF UNIQUE ARRAY[1:10] OF INTEGER;
Python definition:
==================
@TODO
"""
def __init__( self , bound_1 , bound_2 , base_type , UNIQUE = False, scope = None):
BaseType.Type.__init__(self, base_type, scope)
if not isinstance(bound_1, int):
raise TypeError("LIST lower bound must be an integer")
# bound_2 can be set to None
self._unbounded = False
if bound_2 is None:
self._unbounded = True
elif not isinstance(bound_2, int):
raise TypeError("LIST upper bound must be an integer")
if not bound_1>=0:
raise AssertionError("LIST lower bound must be greater of equal to 0")
if (isinstance(bound_2, int) and not (bound_1 <= bound_2)):
raise AssertionError("ARRAY lower bound must be less than or equal to upper bound")
# set up class attributes
self._bound_1 = bound_1
self._bound_2 = bound_2
self._unique = UNIQUE
# preallocate list elements if bounds are both integers
if not self._unbounded:
list_size = bound_2 - bound_1 + 1
self._container = list_size*[None]
# for unbounded list, this will come after
else:
self._container = [None]
def bound_1(self):
return self._bound_1
def bound_2(self):
return self._bound_2
def get_size(self):
number_of_indeterminates = self._container.count(None)
hiindex = len(self._container) - number_of_indeterminates
return INTEGER(hiindex)
def get_hiindex(self):
''' When V is a bag, list or set, the returned value is the actual number of elements in
the aggregate value.'''
number_of_indeterminates = self._container.count(None)
hiindex = len(self._container) - number_of_indeterminates
return INTEGER(hiindex)
def get_loindex(self):
return INTEGER(1)
def get_hibound(self):
hibound = self._bound_2
if isinstance(hibound, int):
return INTEGER(hibound)
else:
return hibound
def get_lobound(self):
lobound = self._bound_1
if isinstance(lobound, int):
return INTEGER(lobound)
else:
return lobound
def get_value_unique(self):
''' Return True if all items are different in the container, UNKNOWN if some items are
indeterminate, or False otherwise'''
if None in self._container:
return Unknown
if self.get_size()-len(set(self._container))>0: #some items are repeated
return False
else:
return True
def __getitem__(self, index):
# case bounded
if not self._unbounded:
if index<self._bound_1:
raise IndexError("ARRAY index out of bound (lower bound is %i, passed %i)"%(self._bound_1,index))
elif(index>self._bound_2):
raise IndexError("ARRAY index out of bound (upper bound is %i, passed %i)"%(self._bound_2,index))
else:
value = self._container[index-self._bound_1]
if value is None:
raise AssertionError("Value with index %i not defined. Please set the value first."%index)
return value
#case unbounded
else:
if index-self._bound_1>len(self._container):
raise AssertionError("Value with index %i not defined. Please set the value first."%index)
else:
value = self._container[index-self._bound_1]
if value is None:
raise AssertionError("Value with index %i not defined. Please set the value first."%index)
return value
def __setitem__(self, index, value):
# case bounded
if not self._unbounded:
if index<self._bound_1:
raise IndexError("ARRAY index out of bound (lower bound is %i, passed %i)"%(self._bound_1,index))
elif(index>self._bound_2):
raise IndexError("ARRAY index out of bound (upper bound is %i, passed %i)"%(self._bound_2,index))
else:
# first check the type of the value
check_type(value,self.get_type())
# then check if the value is already in the array
if self._unique:
if value in self._container:
raise AssertionError("UNIQUE keyword prevent inserting this instance.")
self._container[index-self._bound_1] = value
# case unbounded
else:
if index<self._bound_1:
raise IndexError("ARRAY index out of bound (lower bound is %i, passed %i)"%(self._bound_1,index))
# if the _container list is of good size, just do like the bounded case
if (index-self._bound_1<len(self._container)):
# first check the type of the value
check_type(value,self.get_type)
# then check if the value is already in the array
if self._unique:
if value in self._container:
raise AssertionError("UNIQUE keyword prevent inserting this instance.")
self._container[index-self._bound_1] = value
# in the other case, we have to extend the base _container list
else:
delta_size = (index-self._bound_1) - len(self._container) + 1
#create a list of None, and extend the list
list_extension = delta_size*[None]
self._container.extend(list_extension)
# first check the type of the value
check_type(value,self.get_type())
# then check if the value is already in the array
if self._unique:
if value in self._container:
raise AssertionError("UNIQUE keyword prevent inserting this instance.")
self._container[index-self._bound_1] = value
class BAG(BaseType.Type, BaseType.Aggregate):
"""
EXPRESS definition:
==================
A bag data type has as its domain unordered collections of like elements. The optional lower
and upper bounds, which are integer-valued expressions, define the minimum and maximum
number of elements that can be held in the collection defined by a bag data type.
Syntax:
170 bag_type = BAG [ bound_spec ] OF base_type .
176 bound_spec = '[' bound_1 ':' bound_2 ']' .
174 bound_1 = numeric_expression .
175 bound_2 = numeric_expression .
171 base_type = aggregation_types | simple_types | named_types .
Rules and restrictions:
a) The bound_1 expression shall evaluate to an integer value greater than or equal to
zero. It gives the lower bound, which is the minimum number of elements that can be in a
bag value of this data type. bound_1 shall not produce the indeterminate (?) value.
b) The bound_2 expression shall evaluate to an integer value greater than or equal to
bound_1, or an indeterminate (?) value. It gives the upper bound, which is the maximum
number of elements that can be in a bag value of this data type.
If this value is indeterminate (?) the number of elements in a bag value of this data type is
not be bounded from above.
c) If the bound_spec is omitted, the limits are [0:?].
EXAMPLE 29 (This example defines an attribute as a bag of point (where point is a named data
type assumed to have been declared elsewhere).
a_bag_of_points : BAG OF point;
The value of the attribute named a_bag_of_points can contain zero or more points. The same
point instance may appear more than once in the value of a_bag_of_points.
If the value is required to contain at least one element, the specification can provide a lower bound,
as in:
a_bag_of_points : BAG [1:?] OF point;
The value of the attribute named a_bag_of_points now must contain at least one point.
Python definition:
==================
@TODO
"""
def __init__( self , bound_1 , bound_2 , base_type , scope = None):
BaseType.Type.__init__(self, base_type, scope)
if not isinstance(bound_1, int):
raise TypeError("LIST lower bound must be an integer")
# bound_2 can be set to None
self._unbounded = False
if bound_2 is None:
self._unbounded = True
elif not isinstance(bound_2, int):
raise TypeError("LIST upper bound must be an integer")
if not bound_1>=0:
raise AssertionError("LIST lower bound must be greater of equal to 0")
if (isinstance(bound_2, int) and not (bound_1 <= bound_2)):
raise AssertionError("ARRAY lower bound must be less than or equal to upper bound")
# set up class attributes
self._bound_1 = bound_1
self._bound_2 = bound_2
self._container = []
def bound_1(self):
return self._bound_1
def bound_2(self):
return self._bound_2
def add(self,value):
'''
Adds a value to the bag
'''
if self._unbounded:
check_type(value,self.get_type())
self._container.append(value)
else:
# first ensure that the bag is not full
if len(self._container) == self._bound_2 - self._bound_1 + 1:
raise AssertionError('BAG is full. Impossible to add any more item')
else:
check_type(value,self.get_type())
self._container.append(value)
def get_size(self):
''' When V is a bag, list or set, the returned value is the actual number of elements in
the aggregate value.'''
return INTEGER(len(self._container))
def get_hiindex(self):
''' When V is a bag, list or set, the returned value is the actual number of elements in
the aggregate value.'''
return INTEGER(len(self._container))
def get_loindex(self):
return INTEGER(1)
def get_hibound(self):
hibound = self._bound_2
if isinstance(hibound, int):
return INTEGER(hibound)
else:
return hibound
def get_lobound(self):
lobound = self._bound_1
if isinstance(lobound, int):
return INTEGER(lobound)
else:
return lobound
def get_value_unique(self):
''' Return True if all items are different in the container, UNKNOWN if some items are
indeterminate, or False otherwise'''
if None in self._container:
return Unknown
if self.get_size()-len(set(self._container))>0: #some items are repeated
return False
else:
return True
class SET(BaseType.Type, BaseType.Aggregate):
"""
EXPRESS definition:
==================
A set data type has as its domain unordered collections of like elements. The set data type is
a specialization of the bag data type. The optional lower and upper bounds, which are integer-
valued expressions, define the minimum and maximum number of elements that can be held in
the collection defined by a set data type. The collection defined by set data type shall not
contain two or more elements which are instance equal.
Syntax:
285 set_type = SET [ bound_spec ] OF base_type .
176 bound_spec = '[' bound_1 ':' bound_2 ']' .
174 bound_1 = numeric_expression .
175 bound_2 = numeric_expression .
171 base_type = aggregation_types | simple_types | named_types .
Rules and restrictions:
a) The bound_1 expression shall evaluate to an integer value greater than or equal to
zero. It gives the lower bound, which is the minimum number of elements that can be in a
set value of this data type. bound_1 shall not produce the indeterminate (?) value.
b) The bound_2 expression shall evaluate to an integer value greater than or equal to
bound_1, or an indeterminate (?) value. It gives the upper bound, which is the maximum
number of elements that can be in a set value of this data type.
If this value is indeterminate (?) the number of elements in a set value of this data type is
not be bounded from above.
c) If the bound_spec is omitted, the limits are [0:?].
d) Each element in an occurrence of a set data type shall be different from (i.e., not
instance equal to) every other element in the same set value.
EXAMPLE 30 { This example defines an attribute as a set of points (a named data type assumed
to have been declared elsewhere).
a_set_of_points : SET OF point;
The attribute named a_set_of_points can contain zero or more points. Each point instance (in
the set value) is required to be different from every other point in the set.
If the value is required to have no more than 15 points, the specification can provide an upper bound,
as in:
a_set_of_points : SET [0:15] OF point;
The value of the attribute named a_set_of_points now may contain no more than 15 points.
Python definition:
==================
The difference with the BAG class is that the base container for SET is a set object.
"""
def __init__( self , bound_1 , bound_2 , base_type , scope = None):
BaseType.Type.__init__(self, base_type, scope)
if not isinstance(bound_1, int):
raise TypeError("LIST lower bound must be an integer")
# bound_2 can be set to None
self._unbounded = False
if bound_2 is None:
self._unbounded = True
elif not isinstance(bound_2, int):
raise TypeError("LIST upper bound must be an integer")
if not bound_1>=0:
raise AssertionError("LIST lower bound must be greater of equal to 0")
if (isinstance(bound_2, int) and not (bound_1 <= bound_2)):
raise AssertionError("ARRAY lower bound must be less than or equal to upper bound")
# set up class attributes
self._bound_1 = bound_1
self._bound_2 = bound_2
self._container = set()
def bound_1(self):
return self._bound_1
def bound_2(self):
return self._bound_2
def add(self,value):
'''
Adds a value to the bag
'''
if self._unbounded:
check_type(value,self.get_type())
self._container.add(value)
else:
# first ensure that the bag is not full
if len(self._container) == self._bound_2 - self._bound_1 + 1:
if not value in self._container:
raise AssertionError('SET is full. Impossible to add any more item')
else:
check_type(value,self.get_type())
self._container.add(value)
def get_size(self):
''' When V is a bag, list or set, the returned value is the actual number of elements in
the aggregate value.'''
return INTEGER(len(self._container))
def get_hiindex(self):
''' When V is a bag, list or set, the returned value is the actual number of elements in
the aggregate value.'''
return INTEGER(len(self._container))
def get_loindex(self):
return INTEGER(1)
def get_hibound(self):
hibound = self._bound_2
if isinstance(hibound, int):
return INTEGER(hibound)
else:
return hibound
def get_lobound(self):
lobound = self._bound_1
if isinstance(lobound, int):
return INTEGER(lobound)
else:
return lobound
def get_value_unique(self):
''' Return True if all items are different in the container, UNKNOWN if some items are
indeterminate, or False otherwise'''
if None in self._container:
return Unknown
else:
return True