home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tlx501.zip / SRC / NODECON.CPP < prev    next >
C/C++ Source or Header  |  1996-07-08  |  3KB  |  79 lines

  1. /****************************************************************************
  2.     $Id: nodecon.cpp 501.0 1995/03/07 12:26:18 RON Exp $
  3.  
  4.     Copyright (c) 1991-95 Tarma Software Research. All rights reserved.
  5.  
  6.     Project:    Tarma Library for C++ V5.0
  7.     Author:    Ron van der Wal
  8.  
  9.     Implementation of the TLNodeCon class. This class represents a unary
  10.     constraint in the CSP framework.
  11.  
  12.     $Log: nodecon.cpp $
  13.     Revision 501.0  1995/03/07 12:26:18  RON
  14.     Updated for TLX 5.01
  15.     Revision 1.8  1995/01/31 16:30:18  RON
  16.     Update for release 012
  17.     Added partial support for SunPro C++ compiler
  18.     Revision 1.7  1995/01/06  15:58:05  ron
  19.     Corrected Revision keyword
  20.  
  21.     Revision 1.6  1994/11/16  15:41:28  ron
  22.     Added module info; rearranged #include directives
  23.  
  24.     Revision 1.5  1994/10/10  16:52:17  ron
  25.     Changed to <tlx\solve\csp.h>
  26.  
  27.     Revision 1.4  1994/09/28  14:19:36  ron
  28.     Added WatchVar() and UnwatchVar()
  29.  
  30.     Revision 1.3  1994/09/27  20:22:37  ron
  31.     Changed path separator from / to \
  32.  
  33.     Revision 1.2  1994/09/26  15:43:53  ron
  34.     Changed include file references
  35.  
  36.     Revision 1.1  1994/08/16  18:13:05  ron
  37.     Initial revision
  38.  
  39. ****************************************************************************/
  40.  
  41. #include <tlx\501\_build.h>
  42.  
  43. TLX_MODULE_INFO("$Revision: 501.0 $");
  44.  
  45. #include <tlx\501\solve\csp.h>
  46.  
  47. /*-------------------------------------------------------------------------*/
  48.     TLNodeCon::TLNodeCon(TLVariable &v)
  49.  
  50. /*  Default constructor. Initializes the variable that is referenced by the
  51.     constraint.
  52. ---------------------------------------------------------------------------*/
  53. : mVar(v)
  54. {
  55. }
  56.  
  57. /*-------------------------------------------------------------------------*/
  58.     void TLNodeCon::UnwatchVar()
  59.  
  60. /*  Removes watches from the variable, i.e. removes the current constraint
  61.     from its list of dependent constraints.
  62. ---------------------------------------------------------------------------*/
  63. {
  64.     TLX_ASSERT(mVar.Constraints().Contains(this));
  65.     mVar.RemoveConstraint(this);
  66. }
  67.  
  68. /*-------------------------------------------------------------------------*/
  69.     void TLNodeCon::WatchVar()
  70.  
  71. /*  Sets watches on the variables, i.e. adds the current constraint to
  72.     its list of dependent constraints.
  73. ---------------------------------------------------------------------------*/
  74. {
  75.     TLX_ASSERT(!mVar.Constraints().Contains(this));
  76.     mVar.AddConstraint(this);
  77. }
  78.  
  79.