1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.mappaint;
|
---|
3 |
|
---|
4 | import java.util.Locale;
|
---|
5 | import java.util.Objects;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * A MapCSS keyword.
|
---|
9 | *
|
---|
10 | * For example "<code>round</code>" is a keyword in
|
---|
11 | * <pre>linecap: round;</pre>
|
---|
12 | * Keywords are similar to a Java enum value. In accordance with the CSS
|
---|
13 | * specification, they are parsed case insensitive.
|
---|
14 | */
|
---|
15 | public class Keyword {
|
---|
16 | public final String val;
|
---|
17 |
|
---|
18 | public Keyword(String val) {
|
---|
19 | this.val = val.toLowerCase(Locale.ENGLISH);
|
---|
20 | }
|
---|
21 |
|
---|
22 | @Override
|
---|
23 | public String toString() {
|
---|
24 | return "Keyword{" + val + '}';
|
---|
25 | }
|
---|
26 |
|
---|
27 | @Override
|
---|
28 | public boolean equals(Object obj) {
|
---|
29 | if (this == obj) return true;
|
---|
30 | if (obj == null || getClass() != obj.getClass()) return false;
|
---|
31 | Keyword keyword = (Keyword) obj;
|
---|
32 | return Objects.equals(val, keyword.val);
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | public int hashCode() {
|
---|
37 | return Objects.hash(val);
|
---|
38 | }
|
---|
39 |
|
---|
40 | public static final Keyword AUTO = new Keyword("auto");
|
---|
41 | public static final Keyword BOTTOM = new Keyword("bottom");
|
---|
42 | public static final Keyword CENTER = new Keyword("center");
|
---|
43 | public static final Keyword DEFAULT = new Keyword("default");
|
---|
44 | public static final Keyword RIGHT = new Keyword("right");
|
---|
45 | public static final Keyword THINNEST = new Keyword("thinnest");
|
---|
46 | }
|
---|