Add precondition in query i_th
Remove infix "@" which is deprecated now. Add invariant for values to show that it is always not Void. Add postcondition of add.
This commit is contained in:
@@ -28,8 +28,10 @@ feature -- Initialization
|
|||||||
end
|
end
|
||||||
|
|
||||||
feature -- Access
|
feature -- Access
|
||||||
i_th alias "[]", infix "@" (i: INTEGER):JSON_VALUE is
|
i_th alias "[]" (i: INTEGER):JSON_VALUE is
|
||||||
-- Item at `i'-th position
|
-- Item at `i'-th position
|
||||||
|
require
|
||||||
|
is_valid_index:valid_index (i)
|
||||||
do
|
do
|
||||||
Result := values.i_th (i)
|
Result := values.i_th (i)
|
||||||
end
|
end
|
||||||
@@ -55,7 +57,8 @@ feature -- Change Element
|
|||||||
do
|
do
|
||||||
values.extend(value)
|
values.extend(value)
|
||||||
ensure
|
ensure
|
||||||
has_new_value:old values.count + 1 = values.count
|
has_new_value:old values.count + 1 = values.count and
|
||||||
|
values.has (value)
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Report
|
feature -- Report
|
||||||
@@ -100,5 +103,7 @@ feature -- Report
|
|||||||
feature {NONE} --Implementation
|
feature {NONE} --Implementation
|
||||||
values:ARRAYED_LIST[JSON_VALUE]
|
values:ARRAYED_LIST[JSON_VALUE]
|
||||||
|
|
||||||
|
invariant
|
||||||
|
value_not_void: values /= Void
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user