View Javadoc
1   package net.logAnalyzer.gui.messages.filters;
2   
3   import net.logAnalyzer.converters.LAConverter;
4   import net.logAnalyzer.handlers.LAMessage;
5   
6   /***
7    * This class implements a lower filter.
8    * 
9    * @author Karim REFEYTON
10   * @version 0.1
11   */
12  public final class LowerFilter extends CompareFilter {
13      /***
14       * Constructs a new filter.
15       * 
16       * @param converter
17       *            Converter to compare.
18       * @param value
19       *            Value used to accept or not the messageLabel (depending of
20       *            {@link #accept(LAMessage)} implementation).
21       */
22      public LowerFilter(LAConverter converter, Comparable value) {
23          super(converter, value);
24      }
25  
26      /***
27       * Returns <tt>true</tt> if the messageLabel is accepted by the filter. To be
28       * accepted, the value of the specified converter must be lower than the
29       * specified values.
30       * 
31       * @param message
32       *            Message to check
33       * @return <tt>true</tt> if the messageLabel is accepted.
34       * @see net.logAnalyzer.gui.messages.filters.LAMessagesFilter#accept(net.logAnalyzer.handlers.LAMessage)
35       */
36      public boolean accept(LAMessage message) {
37          return (getValue().compareTo(
38                  message.getValue(getConverterIndex(message))) > 0);
39      }
40  
41      /***
42       * Returns a string representation of the filter. Used to display filter.
43       * 
44       * @return String representation of the filter.
45       */
46      public String toString() {
47          return getConverter().getLabel() + " < "
48                  + getConverter().toString(getValue());
49      }
50  }