stack & queue module

Bug #962216 reported by Matthias Brantner
18
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

Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

Review from Dana:

1. There is no distinction between a "stack" and any other collection. Do we need the distinction ?
I guess so, because available-stacks gives all available-collections, which is wrong.
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* {
  for $collQName in collections-ddl:available-collections() return $collQName
};

(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()? {
  let $stackContent := collections-dml:collection($name)
  return if(fn:not(fn:empty($stackContent))) then $stackContent[1] else ()
};

( 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.

Changed in zorba:
status: New → In Progress
Revision history for this message
Sorin Marian Nasoi (sorin.marian.nasoi) wrote :

wrt. 1: there is no way IMO to make a distinction between a collection/stack/queue because in fact all of them are collections.
Best way, IMO is to update the documentation to reflect the fact that:
 - remove available-stacks/available-queues functions
 - mention the fact that delete will remove that collection

wrt. 2: I could find no trim fucntion in the lp:zorba

Issues 3-8 have been addressed.

Changed in zorba:
status: In Progress → Fix Committed
Changed in zorba:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.