Gridarta Editor
src
model
src
main
java
net
sf
gridarta
model
match
NamedGameObjectMatcher.java
Go to the documentation of this file.
1
/*
2
* Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3
* Copyright (C) 2000-2023 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.model.match;
21
22
import
net
.
sf
.
gridarta
.
model
.
gameobject
.
GameObject
;
23
import
org.jetbrains.annotations.NotNull;
24
import
org.jetbrains.annotations.Nullable;
25
33
public
class
NamedGameObjectMatcher
implements
GameObjectMatcher
{
34
38
private
static
final
long
serialVersionUID
= 1L;
39
44
private
final
int
editType
;
45
50
@NotNull
51
private
final
String
name
;
52
58
private
final
boolean
systemMatcher
;
59
66
@Nullable
67
private
final
GameObjectMatcher
envGameObjectMatcher
;
68
73
@NotNull
74
private
final
GameObjectMatcher
gameObjectMatcher
;
75
80
@NotNull
81
private
final
String
id
;
82
92
public
NamedGameObjectMatcher
(
final
int
editType
, @NotNull
final
String
id
, @NotNull
final
String
name
,
final
boolean
systemMatcher
, @Nullable
final
GameObjectMatcher
envGameObjectMatcher
, @NotNull
final
GameObjectMatcher
gameObjectMatcher
) {
93
this.editType =
editType
;
94
this.
id
=
id
;
95
this.name =
name
;
96
this.systemMatcher =
systemMatcher
;
97
this.envGameObjectMatcher =
envGameObjectMatcher
;
98
this.gameObjectMatcher =
gameObjectMatcher
;
99
}
100
105
@NotNull
106
public
String
getName
() {
107
return
name
;
108
}
109
110
@Override
111
public
boolean
isMatching
(@NotNull
final
GameObject<?, ?, ?>
gameObject) {
112
if
(
envGameObjectMatcher
!=
null
) {
113
return
envGameObjectMatcher
.
isMatching
(gameObject) &&
isMatchingInventory
(gameObject);
114
}
115
116
return
gameObjectMatcher
.
isMatching
(gameObject);
117
}
118
125
@SuppressWarnings(
"TypeMayBeWeakened"
)
// is false warning: weakened type would
126
private
boolean
isMatchingInventory
(@NotNull final
GameObject
<?, ?, ?> gameObject) {
127
for
(
final
GameObject<?, ?, ?>
inv : gameObject) {
128
if
(
gameObjectMatcher
.
isMatching
(inv)) {
129
return
true
;
130
}
131
if
(
isMatchingInventory
(inv)) {
132
return
true
;
133
}
134
}
135
return
false
;
136
}
137
142
@NotNull
143
public
String
getID
() {
144
return
id
;
145
}
146
152
public
int
getEditType
() {
153
return
editType
;
154
}
155
160
public
boolean
isSystemMatcher
() {
161
return
systemMatcher
;
162
}
163
164
}
net.sf.gridarta.model.match.NamedGameObjectMatcher.isMatching
boolean isMatching(@NotNull final GameObject<?, ?, ?> gameObject)
Definition:
NamedGameObjectMatcher.java:111
net.sf.gridarta.model.match.NamedGameObjectMatcher
Definition:
NamedGameObjectMatcher.java:33
net.sf.gridarta
net.sf.gridarta.model.match.NamedGameObjectMatcher.getID
String getID()
Definition:
NamedGameObjectMatcher.java:143
net.sf.gridarta.model.match.NamedGameObjectMatcher.id
final String id
Definition:
NamedGameObjectMatcher.java:81
net.sf.gridarta.model.match.NamedGameObjectMatcher.editType
final int editType
Definition:
NamedGameObjectMatcher.java:44
net.sf.gridarta.model.match.NamedGameObjectMatcher.systemMatcher
final boolean systemMatcher
Definition:
NamedGameObjectMatcher.java:58
net.sf
net.sf.gridarta.model.match.NamedGameObjectMatcher.serialVersionUID
static final long serialVersionUID
Definition:
NamedGameObjectMatcher.java:38
net.sf.gridarta.model.match.NamedGameObjectMatcher.NamedGameObjectMatcher
NamedGameObjectMatcher(final int editType, @NotNull final String id, @NotNull final String name, final boolean systemMatcher, @Nullable final GameObjectMatcher envGameObjectMatcher, @NotNull final GameObjectMatcher gameObjectMatcher)
Definition:
NamedGameObjectMatcher.java:92
net.sf.gridarta.model.match.NamedGameObjectMatcher.envGameObjectMatcher
final GameObjectMatcher envGameObjectMatcher
Definition:
NamedGameObjectMatcher.java:67
net.sf.gridarta.model.match.NamedGameObjectMatcher.gameObjectMatcher
final GameObjectMatcher gameObjectMatcher
Definition:
NamedGameObjectMatcher.java:74
net.sf.gridarta.model.match.GameObjectMatcher
Definition:
GameObjectMatcher.java:30
net.sf.gridarta.model.gameobject.GameObject
Definition:
GameObject.java:36
net.sf.gridarta.model.match.NamedGameObjectMatcher.name
final String name
Definition:
NamedGameObjectMatcher.java:51
net.sf.gridarta.model.gameobject
Definition:
AbstractGameObject.java:20
net
net.sf.gridarta.model.match.NamedGameObjectMatcher.getEditType
int getEditType()
Definition:
NamedGameObjectMatcher.java:152
net.sf.gridarta.var.crossfire.model.gameobject.GameObject<?, ?, ?>
net.sf.gridarta.model.match.NamedGameObjectMatcher.getName
String getName()
Definition:
NamedGameObjectMatcher.java:106
net.sf.gridarta.model.match.NamedGameObjectMatcher.isMatchingInventory
boolean isMatchingInventory(@NotNull final GameObject<?, ?, ?> gameObject)
Definition:
NamedGameObjectMatcher.java:126
net.sf.gridarta.model.match.NamedGameObjectMatcher.isSystemMatcher
boolean isSystemMatcher()
Definition:
NamedGameObjectMatcher.java:160
net.sf.gridarta.model
net.sf.gridarta.model.match.GameObjectMatcher.isMatching
boolean isMatching(@NotNull GameObject<?, ?, ?> gameObject)
Generated by
1.8.17