/usr/share/mozart/doc/demo/node26.html is in mozart-doc 1.4.0-8ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Root functor: Main.oz</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="transportation.html">- Up -</A></TD><TD><A href="node27.html#code.transportation.agentabstractions">Next >></A></TD></TR></TABLE><DIV class="unnumbered" id="code.transportation.main"><H3><A name="code.transportation.main">Root functor: <CODE>Main.oz</CODE></A></H3><P class="margin"><A href="Transport/Main.oz">Source File</A></P><P> </P><BLOCKQUOTE><PRE><SPAN class="keyword">functor</SPAN> <BR> <BR><SPAN class="keyword">prepare</SPAN> <BR> <BR> ArgSpec = record(defaults(rightmost type:bool default:<SPAN class="keyword">true</SPAN>)<BR> random(rightmost type:bool default:<SPAN class="keyword">true</SPAN>))<BR> <BR> %% <SPAN class="comment">Default companies and drivers<BR></SPAN> DefaultScenario = d(<SPAN class="string">'Disney'</SPAN>: [<SPAN class="string">'Mickey'</SPAN>(<SPAN class="string">'Düsseldorf'</SPAN>) <SPAN class="string">'Goofy'</SPAN>(<SPAN class="string">'Berlin'</SPAN>)]<BR> <SPAN class="string">'Oz'</SPAN>: [<SPAN class="string">'Tinman'</SPAN>(<SPAN class="string">'München'</SPAN>) <SPAN class="string">'Toto'</SPAN>(<SPAN class="string">'Saarbrücken'</SPAN>)])<BR> <BR><SPAN class="keyword">import</SPAN> <BR> Application Tk TkTools<BR> <BR> Configure(fonts colors goods)<BR> AgentAbstractions(new)<BR> Agents(broker)<BR> Widgets(entryChooser<BR> map)<BR> Dialogs(about<BR> addCompany remCompany<BR> addDriver remDriver)<BR> Randomizer(<SPAN class="string">'class'</SPAN>)<BR> <BR><SPAN class="keyword">define</SPAN> <BR> <BR> TextBg = Configure<SPAN class="keyword">.</SPAN>colors<SPAN class="keyword">.</SPAN>textBg<BR> TextFont = Configure<SPAN class="keyword">.</SPAN>fonts<SPAN class="keyword">.</SPAN>text<BR> TextWidth = 4<BR> BigTextWidth = 17<BR> <BR> <SPAN class="keyword">class</SPAN> <SPAN class="type">Frontend</SPAN> <BR> <SPAN class="keyword">prop</SPAN> locking<BR> <BR> <SPAN class="keyword">feat</SPAN> <BR> %% <SPAN class="comment">Widget references<BR></SPAN> menu src dst what weight send map randomvar<BR> %% <SPAN class="comment">Agent components<BR></SPAN> agents broker randomizer<BR> %%<SPAN class="comment"> <BR></SPAN> toplevel<BR> <BR> <SPAN class="keyword">attr</SPAN> <BR> src:<SPAN class="keyword">unit</SPAN> dst:<SPAN class="keyword">unit</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(toplevel:T)<BR> <SPAN class="keyword">self.</SPAN>toplevel = T<BR> <BR> ThisRandomizer = {New Randomizer<SPAN class="keyword">.</SPAN><SPAN class="string">'class'</SPAN> init(broker:ThisBroker)}<BR> <BR> RandGo = {New Tk<SPAN class="keyword">.</SPAN>variable tkInit(<SPAN class="keyword">false</SPAN>)}<BR> RandSpeed = {New Tk<SPAN class="keyword">.</SPAN>variable tkInit(1)}<BR> <BR> Menu = {TkTools<SPAN class="keyword">.</SPAN>menubar T T<BR> [menubutton(text: <SPAN class="string">'Transportation'</SPAN> <BR> feature: transportation<BR> menu:<BR> [command(label: <SPAN class="string">'About...'</SPAN> <BR> action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> about)<BR> separator<BR> command(label: <SPAN class="string">'Quit'</SPAN> <BR> action: Application<SPAN class="keyword">.</SPAN>exit <SPAN class="keyword">#</SPAN> 0)])<BR> menubutton(text: <SPAN class="string">'Configure'</SPAN> <BR> feature: configure<BR> menu:<BR> [command(label: <SPAN class="string">'Add Company...'</SPAN> <BR> action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> addCompany<BR> feature: addCompany)<BR> command(label: <SPAN class="string">'Remove Company...'</SPAN> <BR> action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> remCompany<BR> state: disabled<BR> feature: remCompany)<BR> separator<BR> command(label: <SPAN class="string">'Add Driver...'</SPAN> <BR> action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> addDriver<BR> state: disabled<BR> feature: addDriver)<BR> command(label: <SPAN class="string">'Remove Driver...'</SPAN> <BR> action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> remDriver<BR> state: disabled<BR> feature: remDriver)<BR> separator<BR> command(label: <SPAN class="string">'Add Defaults'</SPAN> <BR> action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> addDefaults<BR> feature: addDefaults)])<BR> menubutton(text: <SPAN class="string">'Random'</SPAN> <BR> feature: random<BR> menu: <BR> [radiobutton(label: <SPAN class="string">'Slow'</SPAN> <BR> action: ThisRandomizer <SPAN class="keyword">#</SPAN> slow<BR> variable: RandSpeed<BR> value: 0)<BR> radiobutton(label: <SPAN class="string">'Medium'</SPAN> <BR> action: ThisRandomizer <SPAN class="keyword">#</SPAN> medium<BR> variable: RandSpeed<BR> value: 1)<BR> radiobutton(label: <SPAN class="string">'Fast'</SPAN> <BR> action: ThisRandomizer <SPAN class="keyword">#</SPAN> fast<BR> variable: RandSpeed<BR> value: 2)<BR> separator<BR> checkbutton(label: <SPAN class="string">'Go'</SPAN> <BR> action: ThisRandomizer <SPAN class="keyword">#</SPAN> toggle<BR> variable: RandGo)])<BR> menubutton(text: <SPAN class="string">'Windows'</SPAN> <BR> feature: windows<BR> menu: nil)]<BR> nil}<BR> <BR> CtyMap = {New Widgets<SPAN class="keyword">.</SPAN>map init(parent:<SPAN class="keyword">self</SPAN>)}<BR> Query = {New Tk<SPAN class="keyword">.</SPAN>frame tkInit(parent:T relief:sunken bd:3)}<BR> <BR> FromL = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Query text:<SPAN class="string">'From:'</SPAN>)}<BR> FromT = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Query width:BigTextWidth<BR> anchor:w<BR> bg:TextBg font:TextFont)}<BR> ToL = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Query text:<SPAN class="string">'To:'</SPAN>)}<BR> ToT = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Query width:BigTextWidth<BR> anchor:w<BR> bg:TextBg font:TextFont)}<BR> WhatL = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Query text:<SPAN class="string">'Good:'</SPAN>)}<BR> WhatT = {New Widgets<SPAN class="keyword">.</SPAN>entryChooser<BR> tkInit(parent:Query toplevel:T<BR> entries: {Record<SPAN class="keyword">.</SPAN>toList Configure<SPAN class="keyword">.</SPAN>goods})}<BR> WhgtL = {New Tk<SPAN class="keyword">.</SPAN>label tkInit(parent:Query text:<SPAN class="string">'Weight:'</SPAN>)}<BR> WhgtT = {New Tk<SPAN class="keyword">.</SPAN>entry tkInit(parent:Query width:TextWidth<BR> bg:TextBg font:TextFont)}<BR> <BR> Send = {New Tk<SPAN class="keyword">.</SPAN>button tkInit(parent:Query text:<SPAN class="string">'Send to Broker'</SPAN> <BR> action: <SPAN class="keyword">self</SPAN> <SPAN class="keyword">#</SPAN> send<BR> state: disabled)}<BR> {WhgtT tk(insert 0 25)}<BR> <BR> ThisBroker<BR> <SPAN class="keyword">in</SPAN> <BR> {ForAll [transportation configure random windows]<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> F}<BR> {Menu<SPAN class="keyword">.</SPAN>F<SPAN class="keyword">.</SPAN>menu tk(configure tearoff:<SPAN class="keyword">false</SPAN>)}<BR> <SPAN class="keyword">end</SPAN>}<BR> {Tk<SPAN class="keyword">.</SPAN>batch [pack(FromL FromT ToL ToT<BR> WhatL WhatT WhgtL WhgtT side:left padx:2)<BR> pack(Send side:left padx:6)<BR> pack(Menu CtyMap Query fill:x)]}<BR> <BR> <SPAN class="keyword">self.</SPAN>menu = Menu<BR> <SPAN class="keyword">self.</SPAN>src = FromT<BR> <SPAN class="keyword">self.</SPAN>dst = ToT<BR> <SPAN class="keyword">self.</SPAN>send = Send<BR> <SPAN class="keyword">self.</SPAN>map = CtyMap<BR> <SPAN class="keyword">self.</SPAN>weight = WhgtT<BR> <SPAN class="keyword">self.</SPAN>what = WhatT<SPAN class="keyword">.</SPAN>entry<BR> <BR> ThisBroker = {AgentAbstractions<SPAN class="keyword">.</SPAN>new Agents<SPAN class="keyword">.</SPAN>broker init(toplevel:<SPAN class="keyword">self</SPAN>)}<BR> <BR> <SPAN class="keyword">self.</SPAN>agents = {Dictionary<SPAN class="keyword">.</SPAN>new}<BR> <SPAN class="keyword">self.</SPAN>broker = ThisBroker<BR> <SPAN class="keyword">self.</SPAN>randomizer = ThisRandomizer<BR> <SPAN class="keyword">self.</SPAN>randomvar = RandGo<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">random</SPAN> <BR> {<SPAN class="keyword">self.</SPAN>randomvar tkSet(<SPAN class="keyword">true</SPAN>)}<BR> {<SPAN class="keyword">self.</SPAN>randomizer toggle}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">DisableMenus</SPAN> <BR> {ForAll [transportation configure random]<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> F}<BR> {<SPAN class="keyword">self.</SPAN>menu<SPAN class="keyword">.</SPAN>F tk(configure state:disabled)}<BR> <SPAN class="keyword">end</SPAN>}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">EnableMenus</SPAN> <BR> {ForAll [transportation configure random]<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> F}<BR> {<SPAN class="keyword">self.</SPAN>menu<SPAN class="keyword">.</SPAN>F tk(configure state:normal)}<BR> <SPAN class="keyword">end</SPAN>}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">CheckSend</SPAN> <BR> S=<SPAN class="keyword">@</SPAN>src D=<SPAN class="keyword">@</SPAN>dst<BR> <SPAN class="keyword">in</SPAN> <BR> {<SPAN class="keyword">self.</SPAN>send tk(conf state:<SPAN class="keyword">if</SPAN> S<SPAN class="keyword">\=</SPAN>D <SPAN class="keyword">andthen</SPAN> <BR> {IsAtom S} <SPAN class="keyword">andthen</SPAN> {IsAtom D}<BR> <SPAN class="keyword">then</SPAN> normal<BR> <SPAN class="keyword">else</SPAN> disabled<BR> <SPAN class="keyword">end</SPAN>)}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">putSrc</SPAN>(Src)<BR> <SPAN class="keyword">lock</SPAN> <BR> src <SPAN class="keyword"><-</SPAN> Src {<SPAN class="keyword">self.</SPAN>src tk(conf text:Src)}<BR> Frontend<SPAN class="keyword">,</SPAN> CheckSend<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">putDst</SPAN>(Dst)<BR> <SPAN class="keyword">lock</SPAN> <BR> dst <SPAN class="keyword"><-</SPAN> Dst {<SPAN class="keyword">self.</SPAN>dst tk(conf text:Dst)}<BR> Frontend<SPAN class="keyword">,</SPAN> CheckSend<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">send</SPAN> <BR> <SPAN class="keyword">lock</SPAN> <BR> W = {<SPAN class="keyword">self.</SPAN>weight tkReturnInt(get $)}<BR> <SPAN class="keyword">in</SPAN> <BR> <SPAN class="keyword">if</SPAN> {IsInt W} <SPAN class="keyword">then</SPAN> <BR> {<SPAN class="keyword">self.</SPAN>broker announce(src:<SPAN class="keyword">@</SPAN>src dst:<SPAN class="keyword">@</SPAN>dst weight:W<BR> what:{<SPAN class="keyword">self.</SPAN>what tkReturnAtom(get $)})}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">about</SPAN> <BR> <SPAN class="keyword">lock</SPAN> <BR> Frontend<SPAN class="keyword">,</SPAN> DisableMenus<BR> {Wait {New Dialogs<SPAN class="keyword">.</SPAN>about init(master:<SPAN class="keyword">self.</SPAN>toplevel)}<SPAN class="keyword">.</SPAN>tkClosed}<BR> Frontend<SPAN class="keyword">,</SPAN> EnableMenus<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">addCompany</SPAN> <BR> <SPAN class="keyword">lock</SPAN> Agents=<SPAN class="keyword">self.</SPAN>agents C <SPAN class="keyword">in</SPAN> <BR> Frontend<SPAN class="keyword">,</SPAN> DisableMenus<BR> {Wait {New Dialogs<SPAN class="keyword">.</SPAN>addCompany init(master: <SPAN class="keyword">self.</SPAN>toplevel<BR> agents: Agents<BR> company:C)}<SPAN class="keyword">.</SPAN>tkClosed}<BR> <SPAN class="keyword">if</SPAN> {IsDet C} <SPAN class="keyword">then</SPAN> <BR> Menu = <SPAN class="keyword">self.</SPAN>menu<SPAN class="keyword">.</SPAN>configure<BR> <SPAN class="keyword">in</SPAN> <BR> {Dictionary<SPAN class="keyword">.</SPAN>put Agents C nil}<BR> {<SPAN class="keyword">self.</SPAN>broker add(company:C)}<BR> {Menu<SPAN class="keyword">.</SPAN>remCompany tk(entryconfigure state:normal)}<BR> {Menu<SPAN class="keyword">.</SPAN>addDriver tk(entryconfigure state:normal)}<BR> <SPAN class="keyword">if</SPAN> {Some {Arity DefaultScenario}<BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> C}<BR> {Dictionary<SPAN class="keyword">.</SPAN>member Agents C}<BR> <SPAN class="keyword">end</SPAN>} <SPAN class="keyword">then</SPAN> <BR> {Menu<SPAN class="keyword">.</SPAN>addDefaults tk(entryconfigure state:disabled)}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> Frontend<SPAN class="keyword">,</SPAN> EnableMenus<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">remCompany</SPAN> <BR> <SPAN class="keyword">lock</SPAN> Agents=<SPAN class="keyword">self.</SPAN>agents C <SPAN class="keyword">in</SPAN> <BR> Frontend<SPAN class="keyword">,</SPAN> DisableMenus<BR> {Wait {New Dialogs<SPAN class="keyword">.</SPAN>remCompany init(master: <SPAN class="keyword">self.</SPAN>toplevel<BR> agents: Agents<BR> company:C)}<SPAN class="keyword">.</SPAN>tkClosed}<BR> <SPAN class="keyword">if</SPAN> {IsDet C} <SPAN class="keyword">then</SPAN> <BR> Menu = <SPAN class="keyword">self.</SPAN>menu<SPAN class="keyword">.</SPAN>configure<BR> <SPAN class="keyword">in</SPAN> <BR> {Dictionary<SPAN class="keyword">.</SPAN>remove Agents C}<BR> {<SPAN class="keyword">self.</SPAN>broker remove(company:C)}<BR> <SPAN class="keyword">if</SPAN> {Dictionary<SPAN class="keyword">.</SPAN>entries Agents}<SPAN class="keyword">==</SPAN>nil <SPAN class="keyword">then</SPAN> <BR> {Menu<SPAN class="keyword">.</SPAN>remCompany tk(entryconf state:disabled)}<BR> {Menu<SPAN class="keyword">.</SPAN>addDriver tk(entryconf state:disabled)}<BR> {Menu<SPAN class="keyword">.</SPAN>remDriver tk(entryconf state:disabled)}<BR> {Menu<SPAN class="keyword">.</SPAN>addDefaults tk(entryconfigure state:normal)}<BR> <SPAN class="keyword">elseif</SPAN> {Not {Some {Arity DefaultScenario}<BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> C}<BR> {Dictionary<SPAN class="keyword">.</SPAN>member Agents C}<BR> <SPAN class="keyword">end</SPAN>}} <SPAN class="keyword">then</SPAN> <BR> {Menu<SPAN class="keyword">.</SPAN>addDefaults tk(entryconfigure state:enabled)}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> Frontend<SPAN class="keyword">,</SPAN> EnableMenus<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">addDriver</SPAN> <BR> <SPAN class="keyword">lock</SPAN> Agents=<SPAN class="keyword">self.</SPAN>agents C D Y <SPAN class="keyword">in</SPAN> <BR> Frontend<SPAN class="keyword">,</SPAN> DisableMenus<BR> {Wait {New Dialogs<SPAN class="keyword">.</SPAN>addDriver init(master: <SPAN class="keyword">self.</SPAN>toplevel<BR> agents: Agents<BR> company:C<BR> driver: D<BR> city: Y)}<SPAN class="keyword">.</SPAN>tkClosed}<BR> <SPAN class="keyword">if</SPAN> {IsDet C} <SPAN class="keyword">then</SPAN> <BR> {Dictionary<SPAN class="keyword">.</SPAN>put Agents C D<SPAN class="keyword">|</SPAN>{Dictionary<SPAN class="keyword">.</SPAN>get Agents C}}<BR> {<SPAN class="keyword">self.</SPAN>menu<SPAN class="keyword">.</SPAN>configure<SPAN class="keyword">.</SPAN>remDriver tk(entryconf state:normal)}<BR> {<SPAN class="keyword">self.</SPAN>broker add(company:C driver:D city:Y)}<BR> <SPAN class="keyword">end</SPAN> <BR> Frontend<SPAN class="keyword">,</SPAN> EnableMenus<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">remDriver</SPAN> <BR> <SPAN class="keyword">lock</SPAN> Agents=<SPAN class="keyword">self.</SPAN>agents C D <SPAN class="keyword">in</SPAN> <BR> Frontend<SPAN class="keyword">,</SPAN> DisableMenus<BR> {Wait {New Dialogs<SPAN class="keyword">.</SPAN>remDriver init(master: <SPAN class="keyword">self.</SPAN>toplevel<BR> agents: Agents<BR> company: C<BR> driver: D)}<SPAN class="keyword">.</SPAN>tkClosed}<BR> <SPAN class="keyword">if</SPAN> {IsDet C} <SPAN class="keyword">then</SPAN> <BR> {Dictionary<SPAN class="keyword">.</SPAN>put Agents C<BR> {List<SPAN class="keyword">.</SPAN>subtract {Dictionary<SPAN class="keyword">.</SPAN>get Agents C} D}}<BR> {<SPAN class="keyword">self.</SPAN>broker remove(company:C driver:D)}<BR> <SPAN class="keyword">if</SPAN> {All {Dictionary<SPAN class="keyword">.</SPAN>keys Agents}<BR> <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> C}<BR> {Dictionary<SPAN class="keyword">.</SPAN>get Agents C}<SPAN class="keyword">==</SPAN>nil<BR> <SPAN class="keyword">end</SPAN>}<BR> <SPAN class="keyword">then</SPAN> <BR> {<SPAN class="keyword">self.</SPAN>menu<SPAN class="keyword">.</SPAN>configure<SPAN class="keyword">.</SPAN>remDriver tk(entryconf state:disabled)}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> Frontend<SPAN class="keyword">,</SPAN> EnableMenus<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">addDefaults</SPAN> <BR> <SPAN class="keyword">lock</SPAN> Menu=<SPAN class="keyword">self.</SPAN>menu<SPAN class="keyword">.</SPAN>configure <SPAN class="keyword">in</SPAN> <BR> {Record<SPAN class="keyword">.</SPAN>forAllInd DefaultScenario<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> C Ds}<BR> {Dictionary<SPAN class="keyword">.</SPAN>put <SPAN class="keyword">self.</SPAN>agents C {Map Ds Label}}<BR> {<SPAN class="keyword">self.</SPAN>broker add(company:C)}<BR> {ForAll Ds<BR> <SPAN class="keyword">proc</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">$</SPAN> D}<BR> {<SPAN class="keyword">self.</SPAN>broker add(driver:{Label D} company:C city:D<SPAN class="keyword">.</SPAN>1)}<BR> <SPAN class="keyword">end</SPAN>}<BR> <SPAN class="keyword">end</SPAN>}<BR> {Menu<SPAN class="keyword">.</SPAN>addDefaults tk(entryconf state:disabled)}<BR> {Menu<SPAN class="keyword">.</SPAN>addDriver tk(entryconf state:normal)}<BR> {Menu<SPAN class="keyword">.</SPAN>remCompany tk(entryconf state:normal)}<BR> {Menu<SPAN class="keyword">.</SPAN>remDriver tk(entryconf state:normal)}<BR> <SPAN class="keyword">end</SPAN> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">end</SPAN> <BR> <BR> Args = {Application<SPAN class="keyword">.</SPAN>getCmdArgs ArgSpec}<BR> <BR> T = {New Tk<SPAN class="keyword">.</SPAN>toplevel tkInit(title: <SPAN class="string">'Transportation'</SPAN> <BR> delete: Application<SPAN class="keyword">.</SPAN>exit <SPAN class="keyword">#</SPAN> 0)}<BR> <BR> F = {New Frontend init(toplevel:T)}<BR> <BR> <SPAN class="keyword">if</SPAN> Args<SPAN class="keyword">.</SPAN>defaults <SPAN class="keyword">orelse</SPAN> Args<SPAN class="keyword">.</SPAN>random <SPAN class="keyword">then</SPAN> <BR> {F addDefaults}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR> <SPAN class="keyword">if</SPAN> Args<SPAN class="keyword">.</SPAN>random <SPAN class="keyword">then</SPAN> <BR> {F random}<BR> <SPAN class="keyword">end</SPAN> <BR> <BR><SPAN class="keyword">end</SPAN> <BR> <BR></PRE></BLOCKQUOTE><P></P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="transportation.html">- Up -</A></TD><TD><A href="node27.html#code.transportation.agentabstractions">Next >></A></TD></TR></TABLE><HR><ADDRESS><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|