Ejemplo n.º 1
0
bool
PatternOrder::operator()(const Pattern &m1, const Pattern &m2) const {
  if (m1.attributes.find(key) == m1.attributes.end() ||
      m2.attributes.find(key) == m1.attributes.end())
    throw BadKeyException(key, m1.get_accession());
  string val1 = m1.attributes.find(key)->second;
  string val2 = m2.attributes.find(key)->second;
  if (reverse && numeric) return atof(val1.c_str()) > atof(val2.c_str());
  else if (reverse) return val1 > val2;
  else if (numeric) return atof(val1.c_str()) < atof(val2.c_str());
  else return val1 < val2;
}
Ejemplo n.º 2
0
bool
PatternCutoff::operator()(const Pattern &p) const {
  if (p.attributes.find(key) == p.attributes.end())
    throw BadKeyException(key, p.get_accession());
  string val = p.attributes.find(key)->second;
  if (reverse && numeric) 
    return atof(val.c_str()) > atof(value.c_str());
  else if (reverse) 
    return val > value;
  else if (numeric) 
    return atof(val.c_str()) < atof(value.c_str());
  else return val < value;
}