source: josm/trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilter.java@ 13652

Last change on this file since 13652 was 12474, checked in by Don-vip, 7 years ago

fix #14997 - fix reported issues for autofilter buttons

File size: 1.8 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.autofilter;
3
4import java.util.Objects;
5
6import org.openstreetmap.josm.data.osm.Filter;
7
8/**
9 * An auto filter is a graphical shortcut to enable a filter for a specific tag.
10 * @since 12400
11 */
12public class AutoFilter {
13 private final String label;
14 private final String description;
15 private final Filter filter;
16
17 /**
18 * Constructs a new {@code AutoFilter}.
19 * @param label button label
20 * @param description button tooltip
21 * @param filter associated filter
22 */
23 public AutoFilter(String label, String description, Filter filter) {
24 this.label = label;
25 this.description = description;
26 this.filter = filter;
27 }
28
29 /**
30 * Returns the button label.
31 * @return the button label
32 */
33 public String getLabel() {
34 return label;
35 }
36
37 /**
38 * Returns the button tooltip.
39 * @return the button tooltip
40 */
41 public String getDescription() {
42 return description;
43 }
44
45 /**
46 * Returns the filter.
47 * @return the filter
48 */
49 public Filter getFilter() {
50 return filter;
51 }
52
53 @Override
54 public int hashCode() {
55 return Objects.hash(filter);
56 }
57
58 @Override
59 public boolean equals(Object obj) {
60 if (this == obj)
61 return true;
62 if (obj == null || getClass() != obj.getClass())
63 return false;
64 AutoFilter other = (AutoFilter) obj;
65 return Objects.equals(filter, other.filter);
66 }
67
68 @Override
69 public String toString() {
70 return "AutoFilter [label=" + label + ", description=" + description + ", filter=" + filter + ']';
71 }
72}
Note: See TracBrowser for help on using the repository browser.