COPASI API  4.16.103
Public Member Functions | List of all members
compareProducts Class Reference

#include <CNormalSum.h>

Public Member Functions

bool operator() (const CNormalProduct *product1, const CNormalProduct *product2) const
 

Detailed Description

Definition at line 37 of file CNormalSum.h.

Member Function Documentation

bool compareProducts::operator() ( const CNormalProduct product1,
const CNormalProduct product2 
) const

Definition at line 45 of file CNormalSum.cpp.

References CNormalProduct::getFactor(), and CNormalProduct::getItemPowers().

46 {
47  // first compare the factors
48  if (product1->getFactor() < product2->getFactor())
49  {
50  return true;
51  }
52  else if (product2->getFactor() < product1->getFactor())
53  {
54  return false;
55  }
56 
57  std::set<CNormalItemPower*, compareItemPowers >::const_iterator it;
58  std::set<CNormalItemPower*, compareItemPowers >::const_iterator itEnd = product1->getItemPowers().end();
59  std::set<CNormalItemPower*, compareItemPowers >::const_iterator it2;
60  std::set<CNormalItemPower*, compareItemPowers >::const_iterator it2End = product2->getItemPowers().end();
61 
62  for (it = product1->getItemPowers().begin(), it2 = product2->getItemPowers().begin(); (it != itEnd) && (it2 != it2End); ++it, ++it2)
63  {
64  if (**it < **it2) return true;
65 
66  if (**it2 < **it) return false;
67  }
68 
69  return (product1->getItemPowers().size() < product2->getItemPowers().size());
70 }
const std::set< CNormalItemPower *, compareItemPowers > & getItemPowers() const
const C_FLOAT64 & getFactor() const

The documentation for this class was generated from the following files: