001 package hirondelle.web4jtools.logview.stats; 002 003 import java.util.logging.Level; 004 005 /** 006 * Model Object for a histogram element attached to a logging level. 007 * 008 * <P>This class is mutable. 009 */ 010 public final class LevelBucket { 011 012 /** Full constructor. */ 013 public LevelBucket(Level aLevel){ 014 fLevel = aLevel; 015 validateState(); 016 } 017 018 /** Increase the number of items in this bucket by one. */ 019 public void incrementCount(){ ++fCount; } 020 021 /** Return the number of items in this bucket. */ 022 public Integer getCount(){ return fCount; } 023 024 public Level getLevel(){ return fLevel; } 025 026 // PRIVATE // 027 private Level fLevel; 028 private int fCount; 029 030 private void validateState() { 031 if ( fLevel == null ) { 032 throw new IllegalArgumentException("Level is required."); 033 } 034 } 035 }