home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / VSCPPv8.zip / VACPP / IBMCPP / samples / VISBUILD / VBSAMPLE / IVBDBL.CPP < prev    next >
Text File  |  1995-05-12  |  39KB  |  827 lines

  1. /*******************************************************************************
  2. * FILE NAME: ivbdbl.cpp                                                        *
  3. *                                                                              *
  4. * DESCRIPTION:                                                                 *
  5. *   Class implementation of the class(es):                                     *
  6. *    IVBDoublePart - IBM VB sample Double part.                                *
  7. *                                                                              *
  8. * COPYRIGHT:                                                                   *
  9. *   IBM(R) VisualAge(TM) C++ for OS/2(R), Version 3                            *
  10. *   (C) Copyright IBM Corporation 1991, 1995.                                  *
  11. *    - Licensed Material - Program-Property of IBM - All Rights Reserved.      *
  12. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  13. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  14. *                                                                              *
  15. *   This program will not run in DOS mode.                                     *
  16. *                                                                              *
  17. * DISCLAIMER OF WARRANTIES:                                                    *
  18. *   The following [enclosed] code is sample code created by IBM                *
  19. *   Corporation.  This sample code is not part of any standard IBM product     *
  20. *   and is provided to you solely for the purpose of assisting you in the      *
  21. *   development of your applications.  The code is provided "AS IS",           *
  22. *   without warranty of any kind.  IBM shall not be liable for any damages     *
  23. *   arising out of your use of the sample code, even if they have been         *
  24. *   advised of the possibility of such damages.                                *
  25. *******************************************************************************/
  26.  
  27. #ifndef _IVBDBL_
  28.   #include <ivbdbl.hpp>
  29. #endif
  30.  
  31. #ifndef _INOTIFEV_
  32.   #include <inotifev.hpp>
  33. #endif
  34.  
  35.   #include <complex.h>
  36.  
  37.   #include <math.h>
  38.  
  39.  
  40.  
  41. /*------------------------------------------------------------------------------
  42. | IVBDoublePart::IVBDoublePart                                                 |
  43. |                                                                              |
  44. | Standard constructor.                                                        |
  45. ------------------------------------------------------------------------------*/
  46. #pragma export (IVBDoublePart::IVBDoublePart(double aValue),, 2700)
  47. IVBDoublePart::IVBDoublePart(double aValue) : IVBDataTypePart ()
  48.     ,iValue (aValue)
  49.     ,iDefaultValue (0)
  50.     ,iLowLimit (DBL_MIN)
  51.     ,iHighLimit (DBL_MAX)
  52. {
  53.   enableNotification ();
  54. }
  55.  
  56. /*------------------------------------------------------------------------------
  57. | IVBDoublePart::IVBDoublePart                                                 |
  58. |                                                                              |
  59. | Standard copy constructor.                                                   |
  60. ------------------------------------------------------------------------------*/
  61. #pragma export (IVBDoublePart::IVBDoublePart(const IVBDoublePart&),, 2701)
  62. IVBDoublePart::IVBDoublePart (const IVBDoublePart& partCopy)
  63.   : IVBDataTypePart (partCopy)
  64.     ,iValue (partCopy.value ())
  65.     ,iDefaultValue (partCopy.defaultValue ())
  66.     ,iLowLimit (partCopy.lowLimit ())
  67.     ,iHighLimit (partCopy.highLimit ())
  68. {
  69.   enableNotification ();
  70. }
  71.  
  72. /*------------------------------------------------------------------------------
  73. | IVBDoublePart::IVBDoublePart                                                 |
  74. |                                                                              |
  75. | Standard operator=                                                           |
  76. ------------------------------------------------------------------------------*/
  77. #pragma export (IVBDoublePart::operator= (const IVBDoublePart&),, 2702)
  78. IVBDoublePart& IVBDoublePart::operator= (const IVBDoublePart& aIVBDoublePart)
  79. {
  80.   if (this == &aIVBDoublePart) {
  81.     return *this;
  82.   } /* endif */
  83.   setValue(aIVBDoublePart.value());
  84.   setDefaultValue(aIVBDoublePart.defaultValue());
  85.   setLowLimit(aIVBDoublePart.lowLimit());
  86.   setHighLimit(aIVBDoublePart.highLimit());
  87.   return *this;
  88. }
  89.  
  90. /*------------------------------------------------------------------------------
  91. | IVBDoublePart::~IVBDoublePart                                                |
  92. |                                                                              |
  93. | IVBDoublePart destructor.                                                    |
  94. ------------------------------------------------------------------------------*/
  95. #pragma export (IVBDoublePart::~IVBDoublePart(),, 2703)
  96. IVBDoublePart::~IVBDoublePart()
  97. {
  98. }
  99.  
  100. /*------------------------------------------------------------------------------
  101. | IVBDoublePart::asString                                                      |
  102. |                                                                              |
  103. | Perform asString.                                                            |
  104. ------------------------------------------------------------------------------*/
  105. #pragma export (IVBDoublePart::asString() const,, 2704)
  106. IString IVBDoublePart::asString () const
  107. {
  108.   return valueAsText();
  109. }
  110.  
  111. /*------------------------------------------------------------------------------
  112. | IVBDoublePart::value                                                         |
  113. |                                                                              |
  114. | Return the value attribute.                                                  |
  115. ------------------------------------------------------------------------------*/
  116. #pragma export (IVBDoublePart::value() const,, 2705)
  117. double IVBDoublePart::value () const
  118. {
  119.   return iValue;
  120. }
  121.  
  122. /*------------------------------------------------------------------------------
  123. | IVBDoublePart::setValue                                                      |
  124. |                                                                              |
  125. | Set the value attribute.                                                     |
  126. ------------------------------------------------------------------------------*/
  127. #pragma export (IVBDoublePart::setValue(const double),, 2706)
  128. IVBDoublePart& IVBDoublePart::setValue (double aValue)
  129. {
  130.   if (iValue != aValue) {
  131.     double oldValue = iValue;
  132.     iValue = aValue;
  133.     notifyObservers(INotificationEvent(valueId, *this,
  134.                       true, (void*)&iValue));
  135.     if (iValue < 0) {
  136.       if (!(oldValue < 0)) {
  137.         notifyObservers(INotificationEvent(valueNegativeId, *this,
  138.                         true, (void*)&iValue));
  139.       } ; /* endif */
  140.     } ;
  141.     if (iValue > 0) {
  142.       if (!(oldValue > 0)) {
  143.         notifyObservers(INotificationEvent(valuePositiveId, *this,
  144.                         true, (void*)&iValue));
  145.       } ; /* endif */
  146.     } ; /* endif */
  147.     if (iValue == 0) {
  148.       notifyObservers(INotificationEvent(valueZeroId, *this,
  149.                       true, (void*)&iValue));
  150.     }
  151.     else {
  152.       if (oldValue == 0) {
  153.         notifyObservers(INotificationEvent(valueNotZeroId, *this,
  154.                         true, (void*)&iValue));
  155.       } ; /* endif */
  156.     } ; /* endif */
  157.     if (iDefaultValue == iValue) {
  158.       notifyObservers(INotificationEvent(valueEqualDefaultId, *this,
  159.                       true, (void*)&iValue));
  160.     }
  161.     else {
  162.       if (iDefaultValue == oldValue) {
  163.         notifyObservers(INotificationEvent(valueNotEqualDefaultId, *this,
  164.                         true, (void*)&iValue));
  165.       } /* endif */
  166.     } /* endif */
  167.     if (iValue == iLowLimit) {
  168.       notifyObservers(INotificationEvent(valueEqualLowLimitId, *this,
  169.                       true, (void*)&iValue));
  170.     } ; /* endif */
  171.     if (iLowLimit != DBL_MIN) {
  172.       if (iValue < iLowLimit) {
  173.         if (!(oldValue < iLowLimit)) {
  174.           notifyObservers(INotificationEvent(valueBelowLowLimitId, *this,
  175.                           true, (void*)&iValue));
  176.         } ; /* endif */
  177.       } ; /* endif */
  178.     } ; /* endif */
  179.     if (iValue == iHighLimit) {
  180.       notifyObservers(INotificationEvent(valueEqualHighLimitId, *this,
  181.                       true, (void*)&iValue));
  182.     } ; /* endif */
  183.     if (iHighLimit != DBL_MAX) {
  184.       if (iValue > iHighLimit) {
  185.         if (!(oldValue > iHighLimit)) {
  186.           notifyObservers(INotificationEvent(valueAboveHighLimitId, *this,
  187.                           true, (void*)&iValue));
  188.         } ; /* endif */
  189.       } ; /* endif */
  190.     } ; /* endif */
  191.     if ((iValue >= iLowLimit) && (iValue <= iHighLimit)) {
  192.       if (!((oldValue >= iLowLimit) && (oldValue <= iHighLimit))) {
  193.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  194.                         true, (void*)&iValue));
  195.       } ; /* endif */
  196.     }
  197.     else {
  198.       if (((oldValue >= iLowLimit) && (oldValue <= iHighLimit))) {
  199.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  200.                         true, (void*)&iValue));
  201.       } ; /* endif */
  202.     } ; /* endif */
  203.   } ; /* endif */
  204.   return *this;
  205. }
  206.  
  207. /*------------------------------------------------------------------------------
  208. | IVBDoublePart::setValue                                                      |
  209. |                                                                              |
  210. | Set the value attribute.                                                     |
  211. ------------------------------------------------------------------------------*/
  212. #pragma export (IVBDoublePart::setValue(),, 2707)
  213. IVBDoublePart& IVBDoublePart::setValue ()
  214. {
  215.   return setValue(defaultValue());
  216. }
  217.  
  218. /*------------------------------------------------------------------------------
  219. | IVBDoublePart::valueAsText                                                   |
  220. |                                                                              |
  221. | Return the valueAsText attribute.                                            |
  222. ------------------------------------------------------------------------------*/
  223. #pragma export (IVBDoublePart::valueAsText() const,, 2708)
  224. IString IVBDoublePart::valueAsText () const
  225. {
  226.   return IString (value());
  227. }
  228.  
  229. /*------------------------------------------------------------------------------
  230. | IVBDoublePart::setValueAsText                                                |
  231. |                                                                              |
  232. | Set the valueAsText attribute.                                               |
  233. ------------------------------------------------------------------------------*/
  234. #pragma export (IVBDoublePart::setValueAsText(const IString&),, 2709)
  235. IVBDoublePart& IVBDoublePart::setValueAsText (const IString& aValueAsText)
  236. {
  237.   setValue (aValueAsText.asDouble());
  238.   Boolean iValid = aValueAsText.indexOfAnyBut("+-0123456789. ");
  239.   if (iValid) {
  240.     IString eventData(aValueAsText);
  241.     notifyObservers(INotificationEvent(inputStringNotValidId, *this,
  242.                       true, (void*)&eventData));
  243.   } else {
  244.     IString eventData(aValueAsText);
  245.     notifyObservers(INotificationEvent(inputStringIsValidId, *this,
  246.                       true, (void*)&eventData));
  247.   } /* endif */
  248.   return *this;
  249. }
  250.  
  251. /*------------------------------------------------------------------------------
  252. | IVBDoublePart::setValueAsText                                                |
  253. |                                                                              |
  254. | Set the valueAsText attribute.                                               |
  255. ------------------------------------------------------------------------------*/
  256. #pragma export (IVBDoublePart::setValueAsText(const IString*),, 2710)
  257. IVBDoublePart& IVBDoublePart::setValueAsText (const IString* aValueAsText)
  258. {
  259.   return setValueAsText (*aValueAsText);
  260. }
  261.  
  262. /*------------------------------------------------------------------------------
  263. | IVBDoublePart::valueAs1Based                                                 |
  264. |                                                                              |
  265. | Return the valueAs1Based attribute.                                          |
  266. ------------------------------------------------------------------------------*/
  267. #pragma export (IVBDoublePart::valueAs1Based() const,, 2711)
  268. double IVBDoublePart::valueAs1Based () const
  269. {
  270.   return (value() + 1) ;
  271. }
  272.  
  273. /*------------------------------------------------------------------------------
  274. | IVBDoublePart::setValueAs1Based                                              |
  275. |                                                                              |
  276. | Set the valueAs1Based attribute.                                             |
  277. ------------------------------------------------------------------------------*/
  278. #pragma export (IVBDoublePart::setValueAs1Based(double),, 2712)
  279. IVBDoublePart& IVBDoublePart::setValueAs1Based (double aValueAs1Based)
  280. {
  281.   return setValue (aValueAs1Based - 1);
  282. }
  283.  
  284. /*------------------------------------------------------------------------------
  285. | IVBDoublePart::defaultValue                                                  |
  286. |                                                                              |
  287. | Return the defaultValue attribute.                                           |
  288. ------------------------------------------------------------------------------*/
  289. #pragma export (IVBDoublePart::defaultValue() const,, 2713)
  290. double IVBDoublePart::defaultValue () const
  291. {
  292.   return iDefaultValue;
  293. }
  294.  
  295. /*------------------------------------------------------------------------------
  296. | IVBDoublePart::setDefaultValue                                               |
  297. |                                                                              |
  298. | Set the defaultValue attribute.                                              |
  299. ------------------------------------------------------------------------------*/
  300. #pragma export (IVBDoublePart::setDefaultValue(const double),, 2714)
  301. IVBDoublePart& IVBDoublePart::setDefaultValue (double aDefaultValue)
  302. {
  303.   if (iDefaultValue != aDefaultValue) {
  304.     double oldValue = iDefaultValue;
  305.     iDefaultValue = aDefaultValue;
  306.     notifyObservers(INotificationEvent(defaultValueId, *this,
  307.                       true, (void*)&iDefaultValue));
  308.     if (iDefaultValue == iValue) {
  309.       notifyObservers(INotificationEvent(valueEqualDefaultId, *this,
  310.                       true, (void*)&iValue));
  311.     }
  312.     else {
  313.       if (oldValue == iValue) {
  314.         notifyObservers(INotificationEvent(valueNotEqualDefaultId, *this,
  315.                         true, (void*)&iValue));
  316.       } /* endif */
  317.     } /* endif */
  318.   } /* endif */
  319.   return *this;
  320. }
  321.  
  322. /*------------------------------------------------------------------------------
  323. | IVBDoublePart::isValueEqualDefault                                           |
  324. |                                                                              |
  325. | Return the valueEqualDefault attribute.                                      |
  326. ------------------------------------------------------------------------------*/
  327. #pragma export (IVBDoublePart::isValueEqualDefault() const,, 2715)
  328. Boolean IVBDoublePart::isValueEqualDefault () const
  329. {
  330.   return (value() == defaultValue ()) ;
  331. }
  332.  
  333. /*------------------------------------------------------------------------------
  334. | IVBDoublePart::isValueNotEqualDefault                                        |
  335. |                                                                              |
  336. | Return the valueNotEqualDefault attribute.                                   |
  337. ------------------------------------------------------------------------------*/
  338. #pragma export (IVBDoublePart::isValueNotEqualDefault() const,, 2716)
  339. Boolean IVBDoublePart::isValueNotEqualDefault () const
  340. {
  341.   return (value() != defaultValue ()) ;
  342. }
  343.  
  344. /*------------------------------------------------------------------------------
  345. | IVBDoublePart::lowLimit                                                      |
  346. |                                                                              |
  347. | Return the lowLimit attribute.                                               |
  348. ------------------------------------------------------------------------------*/
  349. #pragma export (IVBDoublePart::lowLimit() const,, 2717)
  350. double IVBDoublePart::lowLimit () const
  351. {
  352.   return iLowLimit;
  353. }
  354.  
  355. /*------------------------------------------------------------------------------
  356. | IVBDoublePart::setLowLimit                                                   |
  357. |                                                                              |
  358. | Set the lowLimit attribute.                                                  |
  359. ------------------------------------------------------------------------------*/
  360. #pragma export (IVBDoublePart::setLowLimit(const double),, 2718)
  361. IVBDoublePart& IVBDoublePart::setLowLimit (double aLowLimit)
  362. {
  363.   if (iLowLimit != aLowLimit) {
  364.     double oldValue = iLowLimit;
  365.     iLowLimit = aLowLimit;
  366.     notifyObservers(INotificationEvent(lowLimitId, *this,
  367.                       true, (void*)&iLowLimit));
  368.     if (iValue == lowLimit()) {
  369.       notifyObservers(INotificationEvent(valueEqualLowLimitId, *this,
  370.                       true, (void*)&iValue));
  371.     } ; /* endif */
  372.     if (lowLimit() != DBL_MIN) {
  373.       if (iValue < iLowLimit) {
  374.         if (!(iValue < oldValue)) {
  375.           notifyObservers(INotificationEvent(valueBelowLowLimitId, *this,
  376.                           true, (void*)&iValue));
  377.         } ; /* endif */
  378.       } ; /* endif */
  379.     } ; /* endif */
  380.     if ((iValue >= lowLimit()) && (iValue <= highLimit())) {
  381.       if (!((iValue >= oldValue) && (iValue <= highLimit()))) {
  382.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  383.                         true, (void*)&iLowLimit));
  384.       } ; /* endif */
  385.     }
  386.     else {
  387.       if ((iValue >= oldValue) && (iValue <= highLimit())) {
  388.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  389.                         true, (void*)&iLowLimit));
  390.       } ; /* endif */
  391.     } ; /* endif */
  392.   } /* endif */
  393.   return *this;
  394. }
  395.  
  396. /*------------------------------------------------------------------------------
  397. | IVBDoublePart::highLimit                                                     |
  398. |                                                                              |
  399. | Return the highLimit attribute.                                              |
  400. ------------------------------------------------------------------------------*/
  401. #pragma export (IVBDoublePart::highLimit() const,, 2719)
  402. double IVBDoublePart::highLimit () const
  403. {
  404.   return iHighLimit;
  405. }
  406.  
  407. /*------------------------------------------------------------------------------
  408. | IVBDoublePart::setHighLimit                                                  |
  409. |                                                                              |
  410. | Set the highLimit attribute.                                                 |
  411. ------------------------------------------------------------------------------*/
  412. #pragma export (IVBDoublePart::setHighLimit(const double),, 2720)
  413. IVBDoublePart& IVBDoublePart::setHighLimit (double aHighLimit)
  414. {
  415.   if (iHighLimit != aHighLimit) {
  416.     double oldValue = iHighLimit;
  417.     iHighLimit = aHighLimit;
  418.     notifyObservers(INotificationEvent(highLimitId, *this,
  419.                       true, (void*)&iHighLimit));
  420.     if (iValue == highLimit()) {
  421.       notifyObservers(INotificationEvent(valueEqualHighLimitId, *this,
  422.                       true, (void*)&iValue));
  423.     } ; /* endif */
  424.     if (highLimit() != DBL_MAX) {
  425.       if (iValue > iHighLimit) {
  426.         if (!(iValue > oldValue)) {
  427.           notifyObservers(INotificationEvent(valueAboveHighLimitId, *this,
  428.                           true, (void*)&iValue));
  429.         } ; /* endif */
  430.       } ; /* endif */
  431.     } ; /* endif */
  432.     if ((iValue >= lowLimit()) && (iValue <= highLimit())) {
  433.       if (!((iValue >= lowLimit()) && (iValue <= oldValue))) {
  434.         notifyObservers(INotificationEvent(valueWithinLimitsId, *this,
  435.                         true, (void*)&iHighLimit));
  436.       } ; /* endif */
  437.     }
  438.     else {
  439.       if ((iValue >= lowLimit()) && (iValue <= oldValue)) {
  440.         notifyObservers(INotificationEvent(valueOutsideLimitsId, *this,
  441.                         true, (void*)&iHighLimit));
  442.       } ; /* endif */
  443.     } ; /* endif */
  444.   } /* endif */
  445.   return *this;
  446. }
  447.  
  448. /*------------------------------------------------------------------------------
  449. | IVBDoublePart::isValueEqualLowLimit                                          |
  450. |                                                                              |
  451. | Return the valueEqualLowLimit attribute.                                     |
  452. ------------------------------------------------------------------------------*/
  453. #pragma export (IVBDoublePart::isValueEqualLowLimit() const,, 2721)
  454. Boolean IVBDoublePart::isValueEqualLowLimit () const
  455. {
  456.   return (value() == lowLimit ()) ;
  457. }
  458.  
  459. /*------------------------------------------------------------------------------
  460. | IVBDoublePart::isValueEqualHighLimit                                         |
  461. |                                                                              |
  462. | Return the valueEqualHighLimit attribute.                                    |
  463. ------------------------------------------------------------------------------*/
  464. #pragma export (IVBDoublePart::isValueEqualHighLimit() const,, 2722)
  465. Boolean IVBDoublePart::isValueEqualHighLimit () const
  466. {
  467.   return (value() == highLimit ()) ;
  468. }
  469.  
  470. /*------------------------------------------------------------------------------
  471. | IVBDoublePart::isValueBelowLowLimit                                          |
  472. |                                                                              |
  473. | Return the valueBelowLowLimit attribute.                                     |
  474. ------------------------------------------------------------------------------*/
  475. #pragma export (IVBDoublePart::isValueBelowLowLimit() const,, 2723)
  476. Boolean IVBDoublePart::isValueBelowLowLimit () const
  477. {
  478.   return (value() < lowLimit ()) ;
  479. }
  480.  
  481. /*------------------------------------------------------------------------------
  482. | IVBDoublePart::isValueAboveHighLimit                                         |
  483. |                                                                              |
  484. | Return the valueAboveHighLimit attribute.                                    |
  485. ------------------------------------------------------------------------------*/
  486. #pragma export (IVBDoublePart::isValueAboveHighLimit() const,, 2724)
  487. Boolean IVBDoublePart::isValueAboveHighLimit () const
  488. {
  489.   return (value() > highLimit ()) ;
  490. }
  491.  
  492. /*------------------------------------------------------------------------------
  493. | IVBDoublePart::isValueOutsideLimits                                          |
  494. |                                                                              |
  495. | Return the valueOutsideLimits attribute.                                     |
  496. ------------------------------------------------------------------------------*/
  497. #pragma export (IVBDoublePart::isValueOutsideLimits() const,, 2725)
  498. Boolean IVBDoublePart::isValueOutsideLimits () const
  499. {
  500.   return ((value() < lowLimit()) || (value() > highLimit())) ;
  501. }
  502.  
  503. /*------------------------------------------------------------------------------
  504. | IVBDoublePart::isValueWithinLimits                                           |
  505. |                                                                              |
  506. | Return the valueWithinLimits attribute.                                      |
  507. ------------------------------------------------------------------------------*/
  508. #pragma export (IVBDoublePart::isValueWithinLimits() const,, 2726)
  509. Boolean IVBDoublePart::isValueWithinLimits () const
  510. {
  511.   return !isValueOutsideLimits ();
  512. }
  513.  
  514. /*------------------------------------------------------------------------------
  515. | IVBDoublePart::isValueNotZero                                                |
  516. |                                                                              |
  517. | Return the valueNotZero attribute.                                           |
  518. ------------------------------------------------------------------------------*/
  519. #pragma export (IVBDoublePart::isValueNotZero() const,, 2727)
  520. Boolean IVBDoublePart::isValueNotZero () const
  521. {
  522.   return (value() != 0) ;
  523. }
  524.  
  525. /*------------------------------------------------------------------------------
  526. | IVBDoublePart::isValueZero                                                   |
  527. |                                                                              |
  528. | Return the valueZero attribute.                                              |
  529. ------------------------------------------------------------------------------*/
  530. #pragma export (IVBDoublePart::isValueZero() const,, 2728)
  531. Boolean IVBDoublePart::isValueZero () const
  532. {
  533.   return (value() == 0) ;
  534. }
  535.  
  536. /*------------------------------------------------------------------------------
  537. | IVBDoublePart::isValuePositive                                               |
  538. |                                                                              |
  539. | Return the valuePositive attribute.                                          |
  540. ------------------------------------------------------------------------------*/
  541. #pragma export (IVBDoublePart::isValuePositive() const,, 2729)
  542. Boolean IVBDoublePart::isValuePositive () const
  543. {
  544.   return (value() > 0) ;
  545. }
  546.  
  547. /*------------------------------------------------------------------------------
  548. | IVBDoublePart::isValueNegative                                               |
  549. |                                                                              |
  550. | Return the valueNegative attribute.                                          |
  551. ------------------------------------------------------------------------------*/
  552. #pragma export (IVBDoublePart::isValueNegative() const,, 2730)
  553. Boolean IVBDoublePart::isValueNegative () const
  554. {
  555.   return (value() < 0) ;
  556. }
  557.  
  558. /*------------------------------------------------------------------------------
  559. | IVBDoublePart::assignValueToZero                                             |
  560. |                                                                              |
  561. | Assign the value attribute to 0.                                             |
  562. ------------------------------------------------------------------------------*/
  563. #pragma export (IVBDoublePart::assignValueToZero(),, 2731)
  564. IVBDoublePart& IVBDoublePart::assignValueToZero ()
  565. {
  566.   return setValue (0) ;
  567. }
  568.  
  569. /*------------------------------------------------------------------------------
  570. | IVBDoublePart::assignValueToOne                                              |
  571. |                                                                              |
  572. | Assign the value attribute to 1.                                             |
  573. ------------------------------------------------------------------------------*/
  574. #pragma export (IVBDoublePart::assignValueToOne(),, 2732)
  575. IVBDoublePart& IVBDoublePart::assignValueToOne ()
  576. {
  577.   return setValue (1) ;
  578. }
  579.  
  580. /*------------------------------------------------------------------------------
  581. | IVBDoublePart::assignValueToLowLimit                                         |
  582. |                                                                              |
  583. | Assign the value attribute to low limit attribute.                           |
  584. ------------------------------------------------------------------------------*/
  585. #pragma export (IVBDoublePart::assignValueToLowLimit(),, 2733)
  586. IVBDoublePart& IVBDoublePart::assignValueToLowLimit ()
  587. {
  588.   return setValue (lowLimit()) ;
  589. }
  590.  
  591. /*------------------------------------------------------------------------------
  592. | IVBDoublePart::assignValueToHighLimit                                        |
  593. |                                                                              |
  594. | Assign the value attribute to high limit attribute.                          |
  595. ------------------------------------------------------------------------------*/
  596. #pragma export (IVBDoublePart::assignValueToHighLimit(),, 2734)
  597. IVBDoublePart& IVBDoublePart::assignValueToHighLimit ()
  598. {
  599.   return setValue (highLimit()) ;
  600. }
  601.  
  602. /*------------------------------------------------------------------------------
  603. | IVBDoublePart::assignValueToDefault                                          |
  604. |                                                                              |
  605. | Assign the value attribute to default.                                       |
  606. ------------------------------------------------------------------------------*/
  607. #pragma export (IVBDoublePart::assignValueToDefault(),, 2735)
  608. IVBDoublePart& IVBDoublePart::assignValueToDefault ()
  609. {
  610.   return setValue (defaultValue ()) ;
  611. }
  612.  
  613. /*------------------------------------------------------------------------------
  614. | IVBDoublePart::assignValueToRandom                                           |
  615. |                                                                              |
  616. | Assign the value attribute to a pseudo-random number.                        |
  617. ------------------------------------------------------------------------------*/
  618. #pragma export (IVBDoublePart::assignValueToRandom(),, 2736)
  619. IVBDoublePart& IVBDoublePart::assignValueToRandom ()
  620. {
  621.   return setValue (rand ()) ;
  622. }
  623.  
  624. /*------------------------------------------------------------------------------
  625. | IVBDoublePart::copyValueToDefault                                            |
  626. |                                                                              |
  627. | Copy the value attribute to default.                                         |
  628. ------------------------------------------------------------------------------*/
  629. #pragma export (IVBDoublePart::copyValueToDefault(),, 2737)
  630. IVBDoublePart& IVBDoublePart::copyValueToDefault ()
  631. {
  632.   return setDefaultValue (value()) ;
  633. }
  634.  
  635. /*------------------------------------------------------------------------------
  636. | IVBDoublePart::squareValue                                                   |
  637. |                                                                              |
  638. | Square the value attribute.                                                  |
  639. ------------------------------------------------------------------------------*/
  640. #pragma export (IVBDoublePart::squareValue(),, 2738)
  641. IVBDoublePart& IVBDoublePart::squareValue()
  642. {
  643.   return setValue (value() * value()) ;
  644. }
  645.  
  646. /*------------------------------------------------------------------------------
  647. | IVBDoublePart::addValue                                                      |
  648. |                                                                              |
  649. | Perform the add operator to the value attribute.                             |
  650. ------------------------------------------------------------------------------*/
  651. #pragma export (IVBDoublePart::addValue (double),, 2739)
  652. IVBDoublePart& IVBDoublePart::addValue (double addValue)
  653. {
  654.   return setValue (value() + addValue) ;
  655. }
  656.  
  657. /*------------------------------------------------------------------------------
  658. | IVBDoublePart::subtractValue                                                 |
  659. |                                                                              |
  660. | Perform the subtract operator to the value attribute.                        |
  661. ------------------------------------------------------------------------------*/
  662. #pragma export (IVBDoublePart::subtractValue (double),, 2740)
  663. IVBDoublePart& IVBDoublePart::subtractValue (double subtractValue)
  664. {
  665.   return setValue (value() - subtractValue) ;
  666. }
  667.  
  668. /*------------------------------------------------------------------------------
  669. | IVBDoublePart::multiplyValue                                                 |
  670. |                                                                              |
  671. | Perform the multiply operator to the value attribute.                        |
  672. ------------------------------------------------------------------------------*/
  673. #pragma export (IVBDoublePart::multiplyValue (double),, 2741)
  674. IVBDoublePart& IVBDoublePart::multiplyValue (double multiplyValue)
  675. {
  676.   return setValue (value() * multiplyValue) ;
  677. }
  678.  
  679. /*------------------------------------------------------------------------------
  680. | IVBDoublePart::divideValue                                                  |
  681. |                                                                             |
  682. | Perform the divide operator to the value attribute.                         |
  683. ------------------------------------------------------------------------------*/
  684. #pragma export (IVBDoublePart::divideValue (double),, 2742)
  685. IVBDoublePart& IVBDoublePart::divideValue (double divideValue)
  686. {
  687.   if (divideValue)
  688.     return setValue (value() / divideValue) ;
  689.   return *this;
  690. }
  691.  
  692. /*------------------------------------------------------------------------------
  693. | IVBDoublePart::ceilValue                                                     |
  694. |                                                                              |
  695. | Perform the ceil function to the value attribute.                            |
  696. ------------------------------------------------------------------------------*/
  697. #pragma export (IVBDoublePart::ceilValue (),, 2743)
  698. IVBDoublePart& IVBDoublePart::ceilValue ()
  699. {
  700.   return setValue (ceil(value())) ;
  701. }
  702.  
  703. /*------------------------------------------------------------------------------
  704. | IVBDoublePart::floorValue                                                    |
  705. |                                                                              |
  706. | Perform the floor function to the value attribute.                           |
  707. ------------------------------------------------------------------------------*/
  708. #pragma export (IVBDoublePart::floorValue (),, 2744)
  709. IVBDoublePart& IVBDoublePart::floorValue ()
  710. {
  711.   return setValue (floor(value())) ;
  712. }
  713.  
  714. /*------------------------------------------------------------------------------
  715. | IVBDoublePart::assignValueToPI                                               |
  716. |                                                                              |
  717. | Assign the value attribute to PI.                                            |
  718. ------------------------------------------------------------------------------*/
  719. #pragma export (IVBDoublePart::assignValueToPI(),, 2745)
  720. IVBDoublePart& IVBDoublePart::assignValueToPI ()
  721. {
  722.   return setValue (M_PI) ;
  723. }
  724.  
  725. /*------------------------------------------------------------------------------
  726. | IVBDoublePart::assignValueToE                                                |
  727. |                                                                              |
  728. | Assign the value attribute to e.                                             |
  729. ------------------------------------------------------------------------------*/
  730. #pragma export (IVBDoublePart::assignValueToE(),, 2746)
  731. IVBDoublePart& IVBDoublePart::assignValueToE ()
  732. {
  733.   return setValue (M_E) ;
  734. }
  735.  
  736. /*------------------------------------------------------------------------------
  737. | IVBDoublePart::operator == (const IVBDoublePart & aValue)                    |
  738. |                                                                              |
  739. ------------------------------------------------------------------------------*/
  740. #pragma export (IVBDoublePart::operator == (const IVBDoublePart&) const,, 2747)
  741. Boolean IVBDoublePart::
  742.   operator == (const IVBDoublePart& aValue) const
  743. {
  744.   if (value() != aValue.value()) {
  745.     return false;
  746.   } /* endif */
  747.   if (defaultValue() != aValue.defaultValue()) {
  748.     return false;
  749.   } /* endif */
  750.   if (lowLimit() != aValue.lowLimit()) {
  751.     return false;
  752.   } /* endif */
  753.   if (highLimit() != aValue.highLimit()) {
  754.     return false;
  755.   } /* endif */
  756.   return true;
  757. }
  758.  
  759. /*------------------------------------------------------------------------------
  760. | IVBDoublePart::operator != (const IVBDoublePart & aValue)                    |
  761. |                                                                              |
  762. ------------------------------------------------------------------------------*/
  763. #pragma export (IVBDoublePart::operator != (const IVBDoublePart&) const,, 2748)
  764. Boolean IVBDoublePart::
  765.   operator != (const IVBDoublePart& aValue) const
  766. {
  767.   if (value() != aValue.value()) {
  768.     return true;
  769.   } /* endif */
  770.   if (defaultValue() != aValue.defaultValue()) {
  771.     return true;
  772.   } /* endif */
  773.   if (lowLimit() != aValue.lowLimit()) {
  774.     return true;
  775.   } /* endif */
  776.   if (highLimit() != aValue.highLimit()) {
  777.     return true;
  778.   } /* endif */
  779.   return false;
  780. }
  781.  
  782. /*------------------------------------------------------------------------------
  783. | IVBDoublePart::operator == (const IVBDoublePart * aValue)                    |
  784. |                                                                              |
  785. ------------------------------------------------------------------------------*/
  786. #pragma export (IVBDoublePart::operator == (const IVBDoublePart*) const,, 2749)
  787. Boolean IVBDoublePart::
  788.   operator == (const IVBDoublePart* aValue) const
  789. {
  790.   if (value() != aValue->value()) {
  791.     return false;
  792.   } /* endif */
  793.   if (defaultValue() != aValue->defaultValue()) {
  794.     return false;
  795.   } /* endif */
  796.   if (lowLimit() != aValue->lowLimit()) {
  797.     return false;
  798.   } /* endif */
  799.   if (highLimit() != aValue->highLimit()) {
  800.     return false;
  801.   } /* endif */
  802.   return true;
  803. }
  804.  
  805. /*------------------------------------------------------------------------------
  806. | IVBDoublePart::operator != (const IVBDoublePart * aValue)                    |
  807. |                                                                              |
  808. ------------------------------------------------------------------------------*/
  809. #pragma export (IVBDoublePart::operator != (const IVBDoublePart*) const,, 2750)
  810. Boolean IVBDoublePart::
  811.   operator != (const IVBDoublePart* aValue) const
  812. {
  813.   if (value() != aValue->value()) {
  814.     return true;
  815.   } /* endif */
  816.   if (defaultValue() != aValue->defaultValue()) {
  817.     return true;
  818.   } /* endif */
  819.   if (lowLimit() != aValue->lowLimit()) {
  820.     return true;
  821.   } /* endif */
  822.   if (highLimit() != aValue->highLimit()) {
  823.     return true;
  824.   } /* endif */
  825.   return false;
  826. }
  827.