20 package net.sf.gridarta.model.connectionview;
22 import java.util.regex.Pattern;
24 import org.jetbrains.annotations.NotNull;
25 import org.jetbrains.annotations.Nullable;
36 private static final Pattern
PATTERN_VALUES = Pattern.compile(
"\\d+(, *\\d+)*");
57 final String connectionSpec = gameObject.getAttributeString(
"connected",
false);
58 if (!PATTERN_VALUES.matcher(connectionSpec).matches()) {
62 final String[] values = PATTERN_VALUE_SEPARATOR.split(connectionSpec.trim(), 0);
63 final int[] result =
new int[values.length];
64 for (
int i = 0; i < values.length; i++) {
65 result[i] = Integer.valueOf(values[i]);
static int [] parseConnections(@NotNull final BaseObject<?, ?, ?, ?> gameObject)
Extract the "connected" value(s) from a given game object.
Connections()
Private constructor to prevent instantiation.
static final Pattern PATTERN_VALUES
Pattern to match the arguments of "connected" fields.
Base package of all Gridarta classes.
Utility class to parse "connected" fields in game objects.
static final Pattern PATTERN_VALUE_SEPARATOR
Pattern to split different values in "connected" field arguments.