func init // adds using namespace sys.add_use('System.Collections.Generic') // initialize the type of element if(isdef('Type')) warning(this.name + ' - manager does not defined') else this.type = code(this.props('Type').value.props('TypeName').value) end // initialize instance params = this.props('Constructor').value if(params == 'Constructor') params = '' elseif(params == 'Constructor2') params = '' + d("collection") elseif(params == 'Constructor3') params = '' + d("capacity") end sys.add_object(this.codename, 'Queue<' + this.type + '>', params) // makes implementation methods for properties sys._prop_init('Count', 1, 0, 1) // makes implementation of methods as properties sys._mtd_as_prop_init('Dequeue()') sys._mtd_as_prop_init('GetEnumerator()') sys._mtd_as_prop_init('Peek()') sys._mtd_as_prop_init('ToArray()') sys._mtd_as_prop_init('Queue') // makes implementation of simple methods sys._method_init('Clear') sys._method_init('TrimExcess') if(linked("onEmpty")) this.setfield('ex', 'ex' + this.id) end end func doConstructor() blk.println(this.codename, ' = new Queue <' + this.type + '> ();') end func doConstructor2(collection) blk.println(this.codename, ' = new Queue <' + this.type + '> (', d("collection"), ');') end func doConstructor3(capacity) blk.println(this.codename, ' = new Queue <' + this.type + '> (', d("capacity"), ');') end func doContains(item) if(linked("onContains")) event("onContains", this.codename + '.Contains(' + d("item") + ')') else blk.println(this.codename, '.Contains(', d("item"), ');') end end func doCopyTo(array, arrayIndex) blk.println(this.codename, '.CopyTo(', d("array"), ', ', d("arrayIndex"), ');') end func doEnqueue(item) blk.println(this.codename, '.Enqueue(', d("item"), ');') end func doDequeue() linked("onEmpty") ? blk.println('try {').inc() : '' event("onDequeue", this.codename + '.Dequeue()') if(linked("onEmpty")) blk.dec().println('} catch(InvalidOperationException ', this.ex, ') {').inc() event("onEmpty", this.ex + '.Message') blk.dec().println('}') end end