Ejemplo n.º 1
0
 /** 
  * move the cursor to the next known stat, returning true if a valid
  * stat is available.
  *
  * @return true if a valid stat is available, otherwise false
  */
 public boolean hasMoreStats() {
     if (_stats.isEmpty())
         return false;
     _currentIsGraphed = false;
     _currentStatName = (String)_stats.remove(0);
     RateStat rs = _context.statManager().getRate(_currentStatName);
     if (rs != null) {
         _currentStatDescription = rs.getDescription();
         if (_currentGroup == null)
             _currentIsFirstInGroup = true;
         else if (!rs.getGroupName().equals(_currentGroup))
             _currentIsFirstInGroup = true;
         else
             _currentIsFirstInGroup = false;
         _currentGroup = rs.getGroupName();
         long period = rs.getPeriods()[0]; // should be the minimum
         if (period <= 10*60*1000) {
             Rate r = rs.getRate(period);
             _currentCanBeGraphed = r != null;
             if (_currentCanBeGraphed) {
                 // see above
                 //_currentIsGraphed = r.getSummaryListener() != null;
                 _currentGraphName = _currentStatName + "." + period;
                 _currentIsGraphed = _graphs.contains(_currentGraphName);
             }
         } else {
             _currentCanBeGraphed = false;
         }
     } else {
         FrequencyStat fs = _context.statManager().getFrequency(_currentStatName);
         if (fs != null) {
             _currentStatDescription = fs.getDescription();
             if (_currentGroup == null)
                 _currentIsFirstInGroup = true;
             else if (!fs.getGroupName().equals(_currentGroup))
                 _currentIsFirstInGroup = true;
             else
                 _currentIsFirstInGroup = false;
             _currentGroup = fs.getGroupName();
             _currentCanBeGraphed = false;
         } else {
             if (_log.shouldLog(Log.ERROR))
                 _log.error("Stat does not exist?!  [" + _currentStatName + "]");
             return false;
         }
     }
     
     if (_filters.contains("*") || _filters.contains(_currentStatName))
         _currentIsLogged = true;
     else
         _currentIsLogged = false;
     return true;
 }