MCPcopy Create free account
hub / github.com/BaseXdb/basex / Token

Class Token

basex-core/src/main/java/org/basex/util/Token.java:26–1493  ·  view source on GitHub ↗

This class provides convenience operations for handling 'Tokens'. A token is a UTF-8 encoded string. It is represented as a byte array. In order to ensure a consistent representation of tokens in the project, all string conversions should be done via the methods of this class. @autho

Source from the content-addressed store, hash-verified

24 * @author Christian Gruen
25 */
26public final class Token {
27 /** Empty token. */
28 public static final byte[] EMPTY = {};
29 /** XML token. */
30 public static final byte[] XML = token("xml");
31 /** XML token with colon. */
32 public static final byte[] XML_COLON = token("xml:");
33 /** XMLNS token. */
34 public static final byte[] XMLNS = token("xmlns");
35 /** XMLNS token with colon. */
36 public static final byte[] XMLNS_COLON = token("xmlns:");
37 /** ID token. */
38 public static final byte[] ID = token("id");
39 /** IDRef token. */
40 public static final byte[] REF = token("ref");
41 /** Token 'true'. */
42 public static final byte[] TRUE = token("true");
43 /** Token 'false'. */
44 public static final byte[] FALSE = token("false");
45 /** Token 'NaN'. */
46 public static final byte[] NAN = token("NaN");
47 /** Token 'INF'. */
48 public static final byte[] POSITIVE_INF = token("INF");
49 /** Token '+INF'. */
50 public static final byte[] POSITIVE_INF_PLUS = token("+INF");
51 /** Token '-INF'. */
52 public static final byte[] NEGATIVE_INF = token("-INF");
53 /** Token 'Infinity'. */
54 public static final byte[] POSITIVE_INFINITY = token("Infinity");
55 /** Token '-Infinity'. */
56 public static final byte[] NEGATIVE_INFINITY = token("-Infinity");
57 /** Minimum long value. */
58 public static final byte[] MIN_LONG = token("-9223372036854775808");
59 /** Minimum integer. */
60 public static final byte[] MIN_INT = token("-2147483648");
61 /** Number '-0'. */
62 public static final byte[] NEGATIVE_ZERO = { '-', '0' };
63
64 /** Comparator for byte arrays. */
65 public static final Comparator<byte[]> COMPARATOR = Token::compare;
66 /** Case-insensitive comparator for byte arrays. */
67 public static final Comparator<byte[]> LC_COMPARATOR = (o1, o2) -> compare(lc(o1), lc(o2));
68 /** Unicode replacement codepoint (\\uFFFD). */
69 public static final char REPLACEMENT = '\uFFFD';
70
71 /** US charset. */
72 public static final DecimalFormatSymbols LOC = new DecimalFormatSymbols(Locale.US);
73 /** Scientific double output. */
74 public static final DecimalFormat SD = new DecimalFormat("0.0##################E0", LOC);
75 /** Decimal double output. */
76 public static final DecimalFormat DD = new DecimalFormat("#####0.0################", LOC);
77 /** Scientific float output. */
78 public static final DecimalFormat SF = new DecimalFormat("0.0######E0", LOC);
79 /** Decimal float output. */
80 public static final DecimalFormat DF = new DecimalFormat("#####0.0######", LOC);
81 /** Adaptive output. */
82 public static final DecimalFormat AD = new DecimalFormat("0.0##########################E0", LOC);
83

Callers

nothing calls this directly

Calls 4

tokenMethod · 0.95
compareMethod · 0.95
lcMethod · 0.95
tokensMethod · 0.95

Tested by

no test coverage detected