git.fiddlerwoaroof.com
menu.e
c6a2b674
 note
 	description: "Summary description for {MENU}."
 	author: ""
 	date: "$Date$"
 	revision: "$Revision$"
 
 class
 	MENU
 
 create
 	make
 
 feature
 	parent: detachable MENU
 	children: LINKED_LIST [MENU]
 	title: STRING
 	link: detachable STRING
 
 	resolveLink: detachable STRING
 		require
 			parent /= void or link /= void
 		do
 			if attached link as a_link then
 				Result := a_link
 			elseif attached parent as a_parent then
 				Result := a_parent.resolveLink
 			end
 		end
 
 	setParent (newParent: MENU)
 		do
 			parent := newParent
 		ensure
 			parent = newParent
 		end
 
 	addChild (child: MENU)
 		do
 			children.put_front (child)
 		end
 
 feature {NONE}
 	make (iTitle: STRING iLink: detachable STRING)
 		do
 			create children.make
 			parent := void
 			title := iTitle
 			link := iLink
 		end
 end