 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.model.filter;
22 import org.jetbrains.annotations.NotNull;
23 import org.jetbrains.annotations.Nullable;
35 private final StringBuilder
sb =
new StringBuilder();
51 boolean first = !enabled;
53 final boolean inverted =
removePrefix(first ?
"inverted" :
",inverted");
59 while (
sb.length() > 0 &&
sb.charAt(0) !=
')') {
69 if (subFilterConfig ==
null) {
70 throw new NumberFormatException(
"filter has no key '" + key +
"'");
73 throw new NumberFormatException(
"syntax error");
85 boolean first = !enabled;
87 while (
sb.length() > 0 &&
sb.charAt(0) !=
')') {
92 throw new NumberFormatException(
"syntax error");
97 throw new NumberFormatException(
"syntax error");
147 }
catch (
final IndexOutOfBoundsException | NumberFormatException ignored) {
150 return sb.length() == 0;
167 throw new NumberFormatException(
"syntax error");
170 this.filterConfig = prevFilterConfig;
180 final int length =
string.length();
181 if (length >
sb.length() || !
sb.substring(0, length).equals(
string)) {
185 sb.delete(0, length);
final StringBuilder sb
The string being decoded.
F getFilter()
Returns the Filter this filter config belongs to.
A FilterConfig that has a name.
static String decodeString(@NotNull final StringBuilder sb)
Decodes a string from a string builder.
void accept(@NotNull FilterConfigVisitor visitor)
Visits the appropriate.
Utility class for codec related functions.
Interface for visitors of filter configs.
final FilterConfigVisitor visitor
The FilterConfigVisitor for updating filterConfig from the string representation in sb.
void decodeInternal(@NotNull final FilterConfig<?, ?> filterConfig)
Updates a file configuration from sb.
final FilterConfigVisitor resetToDefaultsVisitor
The FilterConfigVisitor which resets a filterConfig instance to default settings.
FilterConfig<?, ?> filterConfig
The FilterConfig instance being updated.
boolean decode(@NotNull final String string, @NotNull final FilterConfig<?, ?> filterConfig)
Import the filter configuration settings.
Filter configuration of NamedGameObjectMatcherFilter instances.
boolean removePrefix(@NotNull final String string)
Tries to remove a prefix from sb.
void setEnabled(boolean enabled)
Enables or disables the filter.
Converts a string into a FilterConfig.