Gridarta Editor
Node.java
Go to the documentation of this file.
1
/*
2
* Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3
* Copyright (C) 2000-2015 The Gridarta Developers.
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License along
16
* with this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
*/
19
20
package
net.sf.gridarta.textedit.textarea.tokenmarker;
21
22
import
net
.
sf
.
gridarta
.
textedit
.
textarea
.
Token
;
23
import
org.jetbrains.annotations.NotNull;
24
import
org.jetbrains.annotations.Nullable;
25
30
public
class
Node
{
31
35
private
static
final
char
MIN
=
'A'
;
36
40
private
static
final
char
MAX
=
'z'
;
41
46
private
byte
id
=
Token
.
NULL
;
47
52
@Nullable
53
private
final
Node
@NotNull []
nodes
=
new
Node
[
MAX
-
MIN
+ 1];
54
62
@NotNull
63
public
Node
define
(
final
char
ch) {
64
final
int
index = ch -
MIN
;
65
if
(
nodes
[index] ==
null
) {
66
nodes
[index] =
new
Node
();
67
}
68
return
nodes
[index];
69
}
70
76
@Nullable
77
public
Node
lookup
(
final
char
ch) {
78
return
MIN
<= ch && ch <=
MAX
?
nodes
[ch -
MIN
] :
null
;
79
}
80
85
public
void
setId
(
final
byte
id
) {
86
this.
id
=
id
;
87
}
88
93
public
byte
getId
() {
94
return
id
;
95
}
96
97
}
net.sf.gridarta.textedit.textarea
net.sf.gridarta
net.sf.gridarta.textedit.textarea.Token.NULL
static final byte NULL
Definition:
Token.java:26
net.sf
net.sf.gridarta.textedit.textarea.tokenmarker.Node.nodes
final Node[] nodes
Definition:
Node.java:53
net.sf.gridarta.textedit.textarea.tokenmarker.Node.MIN
static final char MIN
Definition:
Node.java:35
net.sf.gridarta.textedit
net.sf.gridarta.textedit.textarea.Token
Definition:
Token.java:21
net
net.sf.gridarta.textedit.textarea.tokenmarker.Node.MAX
static final char MAX
Definition:
Node.java:40
net.sf.gridarta.textedit.textarea.tokenmarker.Node.setId
void setId(final byte id)
Definition:
Node.java:85
net.sf.gridarta.textedit.textarea.tokenmarker.Node
Definition:
Node.java:30
net.sf.gridarta.textedit.textarea.tokenmarker.Node.getId
byte getId()
Definition:
Node.java:93
net.sf.gridarta.textedit.textarea.tokenmarker.Node.define
Node define(final char ch)
Definition:
Node.java:63
net.sf.gridarta.textedit.textarea.tokenmarker.Node.id
byte id
Definition:
Node.java:46
net.sf.gridarta.textedit.textarea.tokenmarker.Node.lookup
Node lookup(final char ch)
Definition:
Node.java:77
src
textedit
src
main
java
net
sf
gridarta
textedit
textarea
tokenmarker
Node.java
Generated by
1.8.17