/usr/share/mozart/doc/demo/node34.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>Random generation of transportation tasks: Randomizer.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="node33.html#code.transportation.plan"><< Prev</A></TD><TD><A href="transportation.html">- Up -</A></TD><TD><A href="node35.html#code.transportation.widgets">Next >></A></TD></TR></TABLE><DIV class="unnumbered" id="code.transportation.randomizer"><H3><A name="code.transportation.randomizer">Random generation of transportation tasks: <CODE>Randomizer.oz</CODE></A></H3><P class="margin"><A href="Transport/Randomizer.oz">Source File</A></P><P> </P><BLOCKQUOTE><PRE><SPAN class="keyword">functor</SPAN> <BR> <BR><SPAN class="keyword">import</SPAN> <BR>   OS<BR>    <BR>   Configure(delta:    Delta<BR>             delay:    DelayMove<BR>             capacity: Capacity<BR>             goods:    Goods)<BR>   Country(cities)<BR> <BR><SPAN class="keyword">export</SPAN> <BR>   <SPAN class="string">'class'</SPAN>: Randomizer<BR>    <BR><SPAN class="keyword">define</SPAN> <BR> <BR>   %% <SPAN class="comment">Randomizer<BR></SPAN>   <SPAN class="keyword">local</SPAN> <BR>      Speed = (1000 <SPAN class="keyword">*</SPAN> Delta) <SPAN class="keyword">div</SPAN> DelayMove % <SPAN class="comment">Relative speed<BR></SPAN>   <SPAN class="keyword">in</SPAN> <BR>      MedLowTime   = 20 <SPAN class="keyword">*</SPAN> Speed        % <SPAN class="comment">Lower bound for random time interval<BR></SPAN>      MedHighTime  = 3 <SPAN class="keyword">*</SPAN> MedLowTime    % <SPAN class="comment">Upper bound for random time interval<BR></SPAN>      SlowLowTime  = MedLowTime <SPAN class="keyword">div</SPAN> 2  % <SPAN class="comment">Lower bound for random time interval<BR></SPAN>      SlowHighTime = MedHighTime <SPAN class="keyword">div</SPAN> 2 % <SPAN class="comment">Upper bound for random time interval<BR></SPAN>      FastLowTime  = 2 <SPAN class="keyword">*</SPAN> MedLowTime    % <SPAN class="comment">Lower bound for random time interval<BR></SPAN>      FastHighTime = 2 <SPAN class="keyword">*</SPAN> MedHighTime   % <SPAN class="comment">Upper bound for random time interval<BR></SPAN>   <SPAN class="keyword">end</SPAN> <BR>    <BR>   LowGood  = Capacity <SPAN class="keyword">div</SPAN> 10 % <SPAN class="comment">Lower bound for random weight of goods<BR></SPAN>   HighGood = Capacity        % <SPAN class="comment">Upper bound for random weight of goods<BR></SPAN> <BR> <BR>   Cities = {List<SPAN class="keyword">.</SPAN>toTuple <SPAN class="string">'#'</SPAN> Country<SPAN class="keyword">.</SPAN>cities}<BR>    <BR>   <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">RandomDot</SPAN> T}<BR>      T<SPAN class="keyword">.</SPAN>({OS<SPAN class="keyword">.</SPAN>rand} <SPAN class="keyword">mod</SPAN> {Width T} <SPAN class="keyword">+</SPAN> 1)<BR>   <SPAN class="keyword">end</SPAN> <BR>    <BR>   <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">Uniform</SPAN> Low High}<BR>      {OS<SPAN class="keyword">.</SPAN>rand} <SPAN class="keyword">mod</SPAN> (High <SPAN class="keyword">-</SPAN> Low) <SPAN class="keyword">+</SPAN> Low<BR>   <SPAN class="keyword">end</SPAN> <BR>    <BR>   <SPAN class="keyword">fun</SPAN><SPAN class="variablename"> </SPAN>{<SPAN class="functionname">DiffCity</SPAN> City}<BR>      RandCity = {RandomDot Cities}<BR>   <SPAN class="keyword">in</SPAN> <BR>      <SPAN class="keyword">if</SPAN> RandCity<SPAN class="keyword">==</SPAN>City <SPAN class="keyword">then</SPAN> {DiffCity City}<BR>      <SPAN class="keyword">else</SPAN> RandCity<BR>      <SPAN class="keyword">end</SPAN> <BR>   <SPAN class="keyword">end</SPAN> <BR>    <BR>   <SPAN class="keyword">class</SPAN> <SPAN class="type">Randomizer</SPAN> <BR>      <SPAN class="keyword">prop</SPAN> <BR>         final locking<BR>      <SPAN class="keyword">attr</SPAN> <BR>         Stamp: 0<BR>         On:    <SPAN class="keyword">false</SPAN> <BR>         Low:   MedLowTime<BR>         High:  MedHighTime<BR>      <SPAN class="keyword">feat</SPAN> <BR>         broker<BR>       <BR>      <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">init</SPAN>(broker:B)<BR>         <SPAN class="keyword">self.</SPAN>broker = B<BR>      <SPAN class="keyword">end</SPAN> <BR>       <BR>      <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">toggle</SPAN> <BR>         <SPAN class="keyword">case</SPAN> <BR>            <SPAN class="keyword">lock</SPAN> <BR>               <SPAN class="keyword">if</SPAN> <SPAN class="keyword">@</SPAN>On <SPAN class="keyword">then</SPAN> On <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">false</SPAN>  Stamp <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">@</SPAN>Stamp <SPAN class="keyword">+</SPAN> 1 <SPAN class="keyword">~</SPAN>1<BR>               <SPAN class="keyword">else</SPAN> On <SPAN class="keyword"><-</SPAN> <SPAN class="keyword">true</SPAN> <SPAN class="keyword">@</SPAN>Stamp<BR>               <SPAN class="keyword">end</SPAN> <BR>            <SPAN class="keyword">end</SPAN> <BR>         <SPAN class="keyword">of</SPAN> <SPAN class="keyword">~</SPAN>1 <SPAN class="keyword">then</SPAN> <SPAN class="keyword">skip</SPAN> <SPAN class="keyword">elseof</SPAN> S <SPAN class="keyword">then</SPAN> {<SPAN class="keyword">self</SPAN> Go(S)}<BR>         <SPAN class="keyword">end</SPAN> <BR>      <SPAN class="keyword">end</SPAN> <BR>       <BR>      <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">slow</SPAN> <BR>         <SPAN class="keyword">lock</SPAN> Low <SPAN class="keyword"><-</SPAN> SlowLowTime   High <SPAN class="keyword"><-</SPAN> SlowHighTime <SPAN class="keyword">end</SPAN> <BR>      <SPAN class="keyword">end</SPAN> <BR>       <BR>      <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">medium</SPAN> <BR>         <SPAN class="keyword">lock</SPAN> Low <SPAN class="keyword"><-</SPAN> MedLowTime    High <SPAN class="keyword"><-</SPAN> MedHighTime  <SPAN class="keyword">end</SPAN> <BR>      <SPAN class="keyword">end</SPAN> <BR>       <BR>      <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">fast</SPAN> <BR>         <SPAN class="keyword">lock</SPAN> Low <SPAN class="keyword"><-</SPAN> FastLowTime   High <SPAN class="keyword"><-</SPAN> FastHighTime <SPAN class="keyword">end</SPAN> <BR>      <SPAN class="keyword">end</SPAN> <BR>       <BR>      <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">Go</SPAN>(S)<BR>         CurS CurLow CurHigh<BR>      <SPAN class="keyword">in</SPAN> <BR>         <SPAN class="keyword">lock</SPAN> <BR>            CurS    = <SPAN class="keyword">@</SPAN>Stamp<BR>            CurLow  = <SPAN class="keyword">@</SPAN>Low<BR>            CurHigh = <SPAN class="keyword">@</SPAN>High<BR>         <SPAN class="keyword">end</SPAN> <BR>         <SPAN class="keyword">if</SPAN> CurS<SPAN class="keyword">==</SPAN>S <SPAN class="keyword">then</SPAN> <BR>            Src={RandomDot Cities}<BR>         <SPAN class="keyword">in</SPAN> <BR>            {<SPAN class="keyword">self.</SPAN>broker announce(src:    Src<BR>                                  dst:    {DiffCity  Src}<BR>                                  what:   {RandomDot Goods}<BR>                                  weight: {Uniform LowGood HighGood})}<BR>            {Delay {Uniform CurLow CurHigh}}<BR>            {<SPAN class="keyword">self</SPAN> Go(S)}<BR>         <SPAN class="keyword">end</SPAN> <BR>      <SPAN class="keyword">end</SPAN> <BR>       <BR>      <SPAN class="keyword">meth</SPAN> <SPAN class="functionname">close</SPAN> <BR>         <SPAN class="keyword">lock</SPAN> <BR>            {Wait _}<BR>         <SPAN class="keyword">end</SPAN> <BR>      <SPAN class="keyword">end</SPAN> <BR>       <BR>   <SPAN class="keyword">end</SPAN> <BR><SPAN class="keyword">end</SPAN> <BR></PRE></BLOCKQUOTE><P></P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node33.html#code.transportation.plan"><< Prev</A></TD><TD><A href="transportation.html">- Up -</A></TD><TD><A href="node35.html#code.transportation.widgets">Next >></A></TD></TR></TABLE><HR><ADDRESS><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
 |