source: josm/trunk/src/org/openstreetmap/josm/gui/mappaint/Keyword.java@ 12530

Last change on this file since 12530 was 12378, checked in by michael2402, 7 years ago

Document the gui.mappaint package

  • Property svn:eol-style set to native
File size: 1.8 KB
RevLine 
[3967]1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.mappaint;
3
[8404]4import java.util.Locale;
[7083]5import java.util.Objects;
[3967]6
[11137]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 */
[3967]15public class Keyword {
[12378]16 /**
17 * The string value for this keyword
18 */
[3967]19 public final String val;
20
[12378]21 /**
22 * Create a new Keyword
23 * @param val The string value that is written in the MapCSS file
24 */
[3967]25 public Keyword(String val) {
[8404]26 this.val = val.toLowerCase(Locale.ENGLISH);
[3967]27 }
28
29 @Override
30 public String toString() {
31 return "Keyword{" + val + '}';
32 }
33
34 @Override
35 public boolean equals(Object obj) {
[9371]36 if (this == obj) return true;
37 if (obj == null || getClass() != obj.getClass()) return false;
38 Keyword keyword = (Keyword) obj;
39 return Objects.equals(val, keyword.val);
[3967]40 }
41
42 @Override
43 public int hashCode() {
[9371]44 return Objects.hash(val);
[3967]45 }
46
[12378]47 /**
48 * Automated text positioning
49 */
[6889]50 public static final Keyword AUTO = new Keyword("auto");
[12378]51 /**
52 * Align text at the bottom
53 */
[6889]54 public static final Keyword BOTTOM = new Keyword("bottom");
[12378]55 /**
56 * Align text at the center
57 */
[6889]58 public static final Keyword CENTER = new Keyword("center");
[12378]59 /**
60 * Use default line width
61 */
[6889]62 public static final Keyword DEFAULT = new Keyword("default");
[12378]63 /**
64 * Align to the right
65 */
[6889]66 public static final Keyword RIGHT = new Keyword("right");
[12378]67 /**
68 * Thinnest line width
69 */
[6889]70 public static final Keyword THINNEST = new Keyword("thinnest");
[3967]71}
Note: See TracBrowser for help on using the repository browser.