stack & queue module
Bug #962216 reported by
Matthias Brantner
This bug affects 3 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zorba |
Fix Released
|
High
|
Sorin Marian Nasoi |
Bug Description
Implement two new modules:
- stack for node items, using collections
- queue for node items, using collections
Related branches
lp:~zorba-coders/zorba/fix_bug_962216
- Matthias Brantner: Approve
- Sorin Marian Nasoi: Approve
-
Diff: 9 lines (+2/-0)1 file modifiedmodules/ExternalModules.conf (+2/-0)
Changed in zorba: | |
status: | In Progress → Fix Committed |
Changed in zorba: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Review from Dana:
1. There is no distinction between a "stack" and any other collection. Do we need the distinction ? collections, which is wrong.
I guess so, because available-stacks gives all available-
Plus, though the stack module one can delete ANY collection, which also seems wrong.
2. delete() should use the new trim() function on collections from the trunk
3. Delete() should raise an error if the stack doesn't exist, not silently do nothing
4. Documentation does not say that a COPY of the node is inserted in the stack/queue, and NOT
the original node. (copy is made at insertion time, like in a normal collection).
Same comment for the copy() function.
5. create() should raise an error in case the thing already exists, not silently delete it and recreate a
new one.
6. Please re-write THAT into something efficient and decent:
declare function stack:available -stacks( ) as xs:QName* { ddl:available- collections( ) return $collQName
for $collQName in collections-
};
(hint: collections- ddl:available- collections( ) would do)
7. Please rewrite THAT into something efficient and decent:
declare function stack:top($name as xs:QName) as node()? { dml:collection( $name) fn:empty( $stackContent) )) then $stackContent[1] else ()
let $stackContent := collections-
return if(fn:not(
};
( hint: collections- dml:collection( $name)[ 1]
would do )
8. The empty() function should raise an error if the stack/queue doesn't exist. Exist and Empty are
different things.