Gridarta Editor
|
Static Public Member Functions | |
static CharSequence | diffTextString (@NotNull final CharSequence base, @NotNull final String str, final boolean ignoreValues) |
static CharSequence | ensureTrailingNewline (@NotNull final String str) |
static String | getAttribute (@NotNull final CharSequence attributes, @NotNull final String attributeName) |
static String | removeTrailingWhitespace (@NotNull final CharSequence str) |
static String | removeTrailingWhitespaceFromLines (@NotNull final CharSequence str) |
static String | sortLines (@NotNull final CharSequence string) |
Static Public Attributes | |
static final Pattern | PATTERN_BACKSLASH = Pattern.compile("\\\\") |
static final Pattern | PATTERN_COLON = Pattern.compile(":") |
static final Pattern | PATTERN_COMMA = Pattern.compile(",") |
static final Pattern | PATTERN_END_OF_LINE = Pattern.compile("\\s*\n") |
static final Pattern | PATTERN_EQUAL = Pattern.compile("=") |
static final Pattern | PATTERN_NEWLINE = Pattern.compile("\n") |
static final Pattern | PATTERN_SLASH = Pattern.compile("/") |
static final Pattern | PATTERN_SPACE = Pattern.compile(" ") |
static final Pattern | PATTERN_SPACES = Pattern.compile(" +") |
static final Pattern | PATTERN_WHITESPACE = Pattern.compile("[\\x00-\\x09\\x0b\\x20]+") |
static final Pattern | PATTERN_WHITESPACE_NEWLINE = Pattern.compile("[\\x00-\\x0b\\x0d\\x20]+") |
Private Member Functions | |
StringUtils () | |
Static Private Attributes | |
static final Pattern | PATTERN_MULTI_LINE_TRAILING_WHITESPACE = Pattern.compile("(?m)[\\x00-\\x09\\x0b\\x20]+$") |
static final Pattern | PATTERN_TRAILING_WHITESPACE = Pattern.compile("[\\x00-\\x09\\x0b\\x20]+$") |
Utility class for string manipulation.
Definition at line 31 of file StringUtils.java.
|
private |
Private constructor to prevent instantiation.
Definition at line 114 of file StringUtils.java.
|
static |
Helper function for 'diffArchText()': Looks for occurrence of the attribute 'str' in 'base' and if found, returns the full line where 'str' occurs in base. Only occurrences of 'str' at the beginning of a new line are counted as valid. If not found, null is returned.
base | full text to search |
str | string (attribute) to look for |
ignoreValues | if true, lines are matched against 'str' only till the first space (" ") |
Definition at line 162 of file StringUtils.java.
References net.sf.gridarta.utils.StringUtils.PATTERN_END_OF_LINE.
Referenced by net.sf.gridarta.model.io.AttributeListUtils.diffArchTextKeys(), net.sf.gridarta.model.io.AttributeListUtils.diffArchTextValues(), and net.sf.gridarta.utils.StringUtilsTest.testDiffTextString().
|
static |
Returns a given string which ends with a trailing newline character; empty strings remain empty. If the input strings ends in a newline character or if it is empty, it is returned; else a newline character is appended first.
str | the input string |
Definition at line 146 of file StringUtils.java.
Referenced by net.sf.gridarta.model.baseobject.AbstractBaseObject< G, A, R, G >.setMsgText(), and net.sf.gridarta.utils.StringUtilsTest.testEnsureTrailingNewline().
|
static |
Returns an attribute line from a set of attribute definitions. If the set contains more than one instance of
, only the first instance is returned.
attributes | the attribute set to search |
attributeName | the attribute name to search for |
Definition at line 181 of file StringUtils.java.
References net.sf.gridarta.utils.StringUtils.PATTERN_END_OF_LINE.
Referenced by net.sf.gridarta.utils.StringUtilsTest.testGetAttribute().
|
static |
Removes trailing whitespace from a string.
str | the string |
Definition at line 123 of file StringUtils.java.
References net.sf.gridarta.utils.StringUtils.PATTERN_TRAILING_WHITESPACE.
Referenced by net.sf.gridarta.model.baseobject.AbstractBaseObject< G, A, R, G >.addMsgTextLine(), net.sf.gridarta.model.io.AbstractMapArchObjectParser< MapArchObject >.load(), net.sf.gridarta.model.io.TestMapArchObjectParser.parseLine(), net.sf.gridarta.var.daimonin.model.io.MapArchObjectParser.parseLine(), net.sf.gridarta.var.atrinik.model.io.MapArchObjectParser.parseLine(), net.sf.gridarta.var.crossfire.model.io.MapArchObjectParser.parseLine(), net.sf.gridarta.model.baseobject.AbstractBaseObject< G, A, R, G >.setLoreText(), and net.sf.gridarta.utils.StringUtilsTest.testRemoveTrailingWhitespace().
|
static |
Removes trailing whitespace from all lines of a string.
str | the string |
Definition at line 133 of file StringUtils.java.
References net.sf.gridarta.utils.StringUtils.PATTERN_MULTI_LINE_TRAILING_WHITESPACE.
Referenced by net.sf.gridarta.gui.dialog.gameobjectattributes.GameObjectAttributesDialog< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.applySettings2(), net.sf.gridarta.gui.panel.gameobjectattributes.MsgTextTab< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMsgText(), net.sf.gridarta.gui.dialog.gameobjectattributes.DialogAttributeText< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getObjectText(), net.sf.gridarta.model.baseobject.AbstractBaseObject< G, A, R, G >.setMsgText(), and net.sf.gridarta.utils.StringUtilsTest.testRemoveTrailingWhitespaceFromLines().
|
static |
Sorts newline separated lines in a string.
string | the string to sort |
Definition at line 197 of file StringUtils.java.
References net.sf.gridarta.utils.StringUtils.PATTERN_NEWLINE.
Referenced by net.sf.gridarta.model.baseobject.GameObjectText.setObjectText().
|
static |
The pattern that matches a single backslash ("\").
Definition at line 85 of file StringUtils.java.
Referenced by net.sf.gridarta.utils.PathManagerUtils.path().
|
static |
The pattern that matches a single colon (":").
Definition at line 91 of file StringUtils.java.
Referenced by net.sf.gridarta.model.mapcontrol.TestMapControlCreator.createMaps(), and net.sf.gridarta.model.baseobject.AbstractBaseObject< G, A, R, G >.toString().
|
static |
The pattern that matches a single comma (",").
Definition at line 97 of file StringUtils.java.
Referenced by net.sf.gridarta.model.mapmodel.TestMapModelHelper.checkMapContents(), net.sf.gridarta.model.validation.checks.ValidatorFactory< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.createIntegerArray(), net.sf.gridarta.model.validation.checks.ValidatorFactory< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.newValidator(), and net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseInv().
|
static |
The pattern to match end of line characters separating lines.
Definition at line 61 of file StringUtils.java.
Referenced by net.sf.gridarta.model.io.AbstractGameObjectParser< TestGameObject, TestMapArchObject, TestArchetype >.addModifiedFields(), net.sf.gridarta.model.io.AttributeListUtils.diffArchTextKeys(), net.sf.gridarta.model.io.AttributeListUtils.diffArchTextValues(), net.sf.gridarta.utils.StringUtils.diffTextString(), net.sf.gridarta.model.archetype.AbstractArchetypeBuilder< TestGameObject, TestMapArchObject, TestArchetype >.finish(), net.sf.gridarta.utils.StringUtils.getAttribute(), net.sf.gridarta.model.baseobject.GameObjectText.getAttributeKeys(), net.sf.gridarta.model.baseobject.GameObjectText.getAttributeValueInt(), net.sf.gridarta.model.gameobject.GameObjectUtils.getSyntaxErrors(), net.sf.gridarta.model.select.AttributeOtherValueMatchCriteria< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.matches(), net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.parseOutput(), net.sf.gridarta.gui.panel.gameobjecttexteditor.GameObjectTextEditor.refreshDisplay(), net.sf.gridarta.model.io.AttributeListUtils.removeAttribute(), net.sf.gridarta.model.baseobject.GameObjectText.removeAttribute(), and net.sf.gridarta.model.baseobject.GameObjectText.setAttributeValue().
|
static |
The pattern that matches a single equal sign ("=").
Definition at line 103 of file StringUtils.java.
Referenced by net.sf.gridarta.plugin.PluginExecutor< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.executePlugin(), and net.sf.gridarta.textedit.textarea.tokenmarker.DaimoninAITokenMarker.markTokensImpl().
|
staticprivate |
Pattern to match trailing whitespace in a multi line string.
Definition at line 55 of file StringUtils.java.
Referenced by net.sf.gridarta.utils.StringUtils.removeTrailingWhitespaceFromLines().
|
static |
The pattern that matches a single newline ("\n").
Definition at line 109 of file StringUtils.java.
Referenced by net.sf.gridarta.gui.map.renderer.ToolTipAppender< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.appendGameObject(), net.sf.gridarta.model.anim.DefaultAnimationObject.DefaultAnimationObject(), net.sf.gridarta.gui.map.renderer.ToolTipAppender< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.finish(), net.sf.gridarta.utils.StringUtils.sortLines(), net.sf.gridarta.model.anim.AnimationValidator.validateAnimation(), and net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.waitForTermination().
|
static |
The pattern that matches a single slash ("/").
Definition at line 79 of file StringUtils.java.
Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.addMapMenuEntry(), and net.sf.gridarta.model.io.AbstractArchetypeParser< G, A, R, ?>.parseArchetypeFromStream().
|
static |
The pattern that matches a single space.
Definition at line 67 of file StringUtils.java.
Referenced by net.sf.gridarta.model.configsource.DefaultConfigSourceFactory.DefaultConfigSourceFactory(), and net.sf.gridarta.model.gameobject.MultiPositionData.load().
|
static |
The pattern that matches a non-empty sequence of spaces.
Definition at line 73 of file StringUtils.java.
Referenced by net.sf.gridarta.model.io.AbstractGameObjectParser< TestGameObject, TestMapArchObject, TestArchetype >.addModifiedFields(), net.sf.gridarta.model.archetype.AbstractArchetypeBuilder< TestGameObject, TestMapArchObject, TestArchetype >.addObjectText(), net.sf.gridarta.model.archetypetype.AttributeBitmask.decodeValue(), net.sf.gridarta.model.archetype.AbstractArchetypeBuilder< TestGameObject, TestMapArchObject, TestArchetype >.finish(), net.sf.gridarta.model.maplocation.MapLocation.getRandomMapParameter(), net.sf.gridarta.gui.dialog.shortcuts.ShortcutsManager.loadShortcuts(), and net.sf.gridarta.model.select.AttributeOtherValueMatchCriteria< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.matches().
|
staticprivate |
Pattern to match trailing whitespace.
Definition at line 49 of file StringUtils.java.
Referenced by net.sf.gridarta.utils.StringUtils.removeTrailingWhitespace().
|
static |
Pattern to match whitespace excluding NL and CR.
Definition at line 37 of file StringUtils.java.
Referenced by net.sf.gridarta.gui.dialog.prefs.ResPreferences.buildImageSetBox(), net.sf.gridarta.gui.dialog.prefs.GUIPreferences.buildLocaleBox(), net.sf.gridarta.model.match.GameObjectMatcherParser.createTypeNrsArchObjectMatcher(), net.sf.gridarta.model.validation.checks.ValidatorFactory< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.newValidator(), and net.sf.gridarta.var.crossfire.model.io.ArchetypeParser.processLine().
|
static |
Pattern to match whitespace including NL and CR.
Definition at line 43 of file StringUtils.java.
Referenced by net.sf.gridarta.model.archetypetype.ArchetypeTypeSetParser.parseAttributeOrder().