COPASI API  4.16.103
Public Member Functions | List of all members
CNormalLogical::SetOfSetsSorter< TYPE > Class Template Reference

#include <CNormalLogical.h>

Public Member Functions

bool isEqual (const std::pair< TemplateSet< TYPE >, bool > &lhs, const std::pair< TemplateSet< TYPE >, bool > &rhs) const
 
bool operator() (const std::pair< TemplateSet< TYPE >, bool > &lhs, const std::pair< TemplateSet< TYPE >, bool > &rhs) const
 

Detailed Description

template<typename TYPE>
class CNormalLogical::SetOfSetsSorter< TYPE >

Definition at line 89 of file CNormalLogical.h.

Member Function Documentation

template<typename TYPE>
bool CNormalLogical::SetOfSetsSorter< TYPE >::isEqual ( const std::pair< TemplateSet< TYPE >, bool > &  lhs,
const std::pair< TemplateSet< TYPE >, bool > &  rhs 
) const
inline

This routine compares a set of sets and returns true if the first argument is smaller than the second.

Definition at line 138 of file CNormalLogical.h.

References CNormalLogical::SetSorter< TYPE >::isEqual().

Referenced by CNormalLogical::operator==().

140  {
141  bool result = true;
142 
143  if (lhs.second == rhs.second)
144  {
145  if (lhs.first.size() == rhs.first.size())
146  {
147  typename std::set<std::pair<TYPE*, bool>, CNormalLogical::SetSorter <TYPE> >::const_iterator
148  it = lhs.first.begin(),
149  endit = lhs.first.end(),
150  it2 = rhs.first.begin();
151 
152  SetSorter<TYPE> sorter;
153 
154  while (it != endit && result == true)
155  {
156  result = sorter.isEqual(*it, *it2);
157  ++it;
158  ++it2;
159  }
160  }
161  else
162  {
163  result = false;
164  }
165  }
166  else
167  {
168  result = false;
169  }
170 
171  return result;
172  }
bool isEqual(const std::pair< TYPE *, bool > &lhs, const std::pair< TYPE *, bool > &rhs) const
template<typename TYPE>
bool CNormalLogical::SetOfSetsSorter< TYPE >::operator() ( const std::pair< TemplateSet< TYPE >, bool > &  lhs,
const std::pair< TemplateSet< TYPE >, bool > &  rhs 
) const
inline

This routine compares a set of sets and returns true if the first argument is smaller than the second.

Definition at line 96 of file CNormalLogical.h.

97  {
98  bool result = false;
99 
100  if (lhs.second == rhs.second)
101  {
102  if (lhs.first.size() == rhs.first.size())
103  {
104  typename std::set<std::pair<TYPE*, bool>, CNormalLogical::SetSorter<TYPE> >::const_iterator it = lhs.first.begin(), endit = lhs.first.end(), it2 = rhs.first.begin();
105  SetSorter<TYPE> sorter;
106 
107  while (it != endit && result == false)
108  {
109  // first test the other way round because if
110  // it2 is less then it, we can already stop
111  if (sorter(*it2, *it) == true)
112  {
113  break;
114  }
115 
116  result = sorter(*it, *it2);
117  ++it;
118  ++it2;
119  }
120  }
121  else if (lhs.first.size() < rhs.first.size())
122  {
123  result = true;
124  }
125  }
126  else if (lhs.second == true)
127  {
128  result = true;
129  }
130 
131  return result;
132  }

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