/usr/share/mozart/doc/cpitut/node17.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>Accessing the Constraint Store</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="node16.html#ct.casestudy.impl.constraint"><< Prev</A></TD><TD><A href="node13.html">- Up -</A></TD><TD><A href="node18.html#ct.casestudy.impl.expect">Next >></A></TD></TR></TABLE><DIV id="ct.casestudy.impl.rivar"><H4><A name="ct.casestudy.impl.rivar">Accessing the Constraint Store</A></H4><P>The class <CODE>RIVar</CODE> is defined to provide access to a real-interval variable in the constraint store. The class <CODE>RIVar</CODE> is derived from <CODE>OZ_CtVar</CODE>. The private and protected part of the class definition of <CODE>RIVar</CODE> is the implementation of the principle described in <A href="../cpiref/node14.html#ct.reference.ctvar">Section 2.5 of ``The Mozart Constraint Extensions Reference''</A> for real-interval constraints. </P><BLOCKQUOTE class="linenumbers"><PRE><SPAN class="keyword">class</SPAN> <SPAN class="type">RIVar</SPAN> : <SPAN class="keyword">public</SPAN> <SPAN class="type">OZ_CtVar</SPAN> {<BR><SPAN class="keyword">private</SPAN>:<BR> <BR> <SPAN class="type">RI</SPAN> * <SPAN class="variablename">_ref</SPAN>;<BR> <SPAN class="type">RI</SPAN> <SPAN class="variablename">_copy</SPAN>, <SPAN class="variablename">_encap</SPAN>;<BR> <BR> <SPAN class="type">RIProfile</SPAN> <SPAN class="variablename">_rip</SPAN>;<BR> <BR><SPAN class="keyword">protected</SPAN>:<BR> <BR> <SPAN class="keyword">virtual</SPAN> <SPAN class="type">void</SPAN> <SPAN class="functionname">ctSetValue</SPAN>(<SPAN class="type">OZ_Term</SPAN> <SPAN class="variablename">t</SPAN>)<BR> {<BR> _copy.init(t);<BR> _ref = &_copy;<BR> }<BR> <BR> <SPAN class="keyword">virtual</SPAN> <SPAN class="type">OZ_Ct</SPAN> * <SPAN class="functionname">ctRefConstraint</SPAN>(<SPAN class="type">OZ_Ct</SPAN> * <SPAN class="variablename">c</SPAN>)<BR> {<BR> <SPAN class="keyword">return</SPAN> _ref = (<SPAN class="type">RI</SPAN> *) c;<BR> }<BR> <BR> <SPAN class="keyword">virtual</SPAN> <SPAN class="type">OZ_Ct</SPAN> * <SPAN class="functionname">ctSaveConstraint</SPAN>(<SPAN class="type">OZ_Ct</SPAN> * <SPAN class="variablename">c</SPAN>)<BR> {<BR> _copy = *(<SPAN class="type">RI</SPAN> *) c;<BR> <SPAN class="keyword">return</SPAN> &_copy;<BR> }<BR> <BR> <SPAN class="keyword">virtual</SPAN> <SPAN class="type">OZ_Ct</SPAN> * <SPAN class="functionname">ctSaveEncapConstraint</SPAN>(<SPAN class="type">OZ_Ct</SPAN> * <SPAN class="variablename">c</SPAN>)<BR> {<BR> _encap = *(<SPAN class="type">RI</SPAN> *) c;<BR> <SPAN class="keyword">return</SPAN> &_encap;<BR> }<BR> <BR> <SPAN class="keyword">virtual</SPAN> <SPAN class="type">void</SPAN> <SPAN class="functionname">ctRestoreConstraint</SPAN>(<SPAN class="type">void</SPAN>)<BR> {<BR> *_ref = _copy;<BR> }<BR> <BR> <SPAN class="keyword">virtual</SPAN> <SPAN class="type">void</SPAN> <SPAN class="functionname">ctSetConstraintProfile</SPAN>(<SPAN class="type">void</SPAN>)<BR> {<BR> _rip = *_ref->getProfile();<BR> }<BR> <BR> <SPAN class="keyword">virtual</SPAN> <SPAN class="type">OZ_CtProfile</SPAN> * <SPAN class="functionname">ctGetConstraintProfile</SPAN>(<SPAN class="type">void</SPAN>)<BR> {<BR> <SPAN class="keyword">return</SPAN> &_rip;<BR> }<BR> <BR> <SPAN class="keyword">virtual</SPAN> <SPAN class="type">OZ_Ct</SPAN> * <SPAN class="functionname">ctGetConstraint</SPAN>(<SPAN class="type">void</SPAN>)<BR> {<BR> <SPAN class="keyword">return</SPAN> _ref;<BR> }<BR> <BR><SPAN class="keyword">public</SPAN>:<BR> <BR> <SPAN class="functionname">RIVar</SPAN>(<SPAN class="type">void</SPAN>) : OZ_CtVar() { }<BR> <BR> <SPAN class="functionname">RIVar</SPAN>(<SPAN class="type">OZ_Term</SPAN> <SPAN class="variablename">t</SPAN>) : OZ_CtVar() { read(t); }<BR> <BR> <SPAN class="keyword">virtual</SPAN> <SPAN class="type">OZ_Boolean</SPAN> <SPAN class="functionname">isTouched</SPAN>(<SPAN class="type">void</SPAN>) <SPAN class="keyword">const</SPAN> <BR> {<BR> <SPAN class="keyword">return</SPAN> _ref->isTouched(_rip);<BR> }<BR> <BR> <SPAN class="type">RI</SPAN> &<SPAN class="keyword">operator</SPAN> <SPAN class="functionname">*</SPAN> (<SPAN class="type">void</SPAN>) { <SPAN class="keyword">return</SPAN> *_ref; }<BR> <SPAN class="type">RI</SPAN> * <SPAN class="keyword">operator</SPAN> <SPAN class="functionname">-></SPAN> (<SPAN class="type">void</SPAN>) { <SPAN class="keyword">return</SPAN> _ref; }<BR> <BR>};<BR></PRE></BLOCKQUOTE><P> The public part of the class definition is self-explanatory. It provides for constructors, the function <CODE>isTouched()</CODE> to enable the C<SPAN class="allcaps">PI</SPAN> to detect if a parameter has been changed, and operators to provide direct access to the real-interval constraints. </P></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node16.html#ct.casestudy.impl.constraint"><< Prev</A></TD><TD><A href="node13.html">- Up -</A></TD><TD><A href="node18.html#ct.casestudy.impl.expect">Next >></A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~tmueller/">Tobias Müller</A><BR><SPAN class="version">Version 1.4.0 (20110908185330)</SPAN></ADDRESS></BODY></HTML>
|