Changeset 998 for branches


Ignore:
Timestamp:
Jan 1, 2010, 11:54:32 PM (12 years ago)
Author:
Peter Johansson
Message:

Fixes #434. Authors are now ignored in the plot if and only if plot
would be y=0.

Location:
branches/0.7-stable/lib
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/0.7-stable/lib/AddStats.cc

    r847 r998  
    7777
    7878
     79  unsigned int AddStats::max_element(const std::vector<unsigned int>& v) const
     80  {
     81    assert(v.size());
     82    return v.back();
     83  }
     84
     85
    7986}} // end of namespace svndigest and namespace theplu
  • branches/0.7-stable/lib/AddStats.h

    r847 r998  
    4444  private:
    4545    void do_parse(const std::string&, svn_revnum_t);
     46    unsigned int max_element(const std::vector<unsigned int>&) const;
    4647
    4748  };
  • branches/0.7-stable/lib/BlameStats.cc

    r847 r998  
    118118
    119119
     120  unsigned int BlameStats::max_element(const std::vector<unsigned int>& v) const
     121  {
     122    assert(v.size());
     123    return v.back();
     124  }
     125
    120126}} // end of namespace svndigest and namespace theplu
  • branches/0.7-stable/lib/BlameStats.h

    r847 r998  
    4545    void do_parse(const std::string&, svn_revnum_t);
    4646    void fill_in(Author2Vector&, svn_revnum_t rev);
     47    unsigned int max_element(const std::vector<unsigned int>&) const;
    4748
    4849  };
  • branches/0.7-stable/lib/Stats.cc

    r994 r998  
    332332      }
    333333    }
     334  }
     335
     336
     337  unsigned int Stats::max_element(const std::vector<unsigned int>& vec) const
     338  {
     339    return *std::max_element(vec.begin(), vec.end());
    334340  }
    335341
     
    380386    for (std::set<std::string>::const_iterator i=authors_.begin();
    381387         i != authors_.end(); ++i) {
    382       if (lines(*i)) {
    383         assert(stat->find(*i)!=stat->end());
    384         author_cont.push_back(std::make_pair(*i,get_vector(*stat,*i)));
     388      assert(stat->find(*i)!=stat->end());
     389      const std::vector<unsigned int>& vec = get_vector(*stat,*i);
     390      if (max_element(vec)) {
     391        author_cont.push_back(std::make_pair(*i,vec));
    385392      }
    386393    }
  • branches/0.7-stable/lib/Stats.h

    r994 r998  
    233233    unsigned int get_back(const Author2Vector&, std::string user) const;
    234234    void load(std::istream& is, Author2Vector& m);
     235    /**
     236       Finds the largets element by iterating through the entire
     237       vector. Inherited classes should implement their own version
     238       when it is possible to get the largest element in faster than
     239       in linear time.
     240
     241       \return the largest largest element in \a v.
     242    */
     243    virtual unsigned int max_element(const std::vector<unsigned int>& v) const;
     244
    235245    void print(std::ostream& os, const Author2Vector& m) const;
    236246
  • branches/0.7-stable/lib/copyright_year.cc

    r847 r998  
    2929  std::string svn_year(void)
    3030  {
    31     return "2009";
     31    return "2010";
    3232  }
    3333
Note: See TracChangeset for help on using the changeset viewer.