blank() -> isBlank().

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3749 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2005-11-09 04:00:16 +00:00
parent 365634146c
commit 596d2a4708
26 changed files with 51 additions and 51 deletions
@@ -264,7 +264,7 @@ public class ConfObjRegistry
// don't freak out if the conf is blank. // don't freak out if the conf is blank.
String value = config.getValue(key, ""); String value = config.getValue(key, "");
if (StringUtil.blank(value)) { if (StringUtil.isBlank(value)) {
return; return;
} }
@@ -1,5 +1,5 @@
// //
// $Id: ActionRuleSet.java,v 1.4 2004/08/27 02:12:28 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -129,7 +129,7 @@ public class ActionRuleSet extends RuleSetBase
*/ */
public static String validate (ActionSequence seq) public static String validate (ActionSequence seq)
{ {
if (StringUtil.blank(seq.name)) { if (StringUtil.isBlank(seq.name)) {
return "Missing 'name' definition."; return "Missing 'name' definition.";
} }
if (seq.framesPerSecond == 0) { if (seq.framesPerSecond == 0) {
@@ -422,7 +422,7 @@ public class ChatDirector extends BasicDirector
// if not a command then just speak // if not a command then just speak
String message = text.trim(); String message = text.trim();
if (StringUtil.blank(message)) { if (StringUtil.isBlank(message)) {
// report silent failure for now // report silent failure for now
return ChatCodes.SUCCESS; return ChatCodes.SUCCESS;
} }
@@ -673,7 +673,7 @@ public class ChatDirector extends BasicDirector
// note whether or not we have an auto-response // note whether or not we have an auto-response
BodyObject self = (BodyObject) BodyObject self = (BodyObject)
_ctx.getClient().getClientObject(); _ctx.getClient().getClientObject();
if (!StringUtil.blank(self.awayMessage)) { if (!StringUtil.isBlank(self.awayMessage)) {
autoResponse = self.awayMessage; autoResponse = self.awayMessage;
} }
} }
@@ -1090,7 +1090,7 @@ public class ChatDirector extends BasicDirector
String hcmd = ""; String hcmd = "";
// grab the command they want help on // grab the command they want help on
if (!StringUtil.blank(args)) { if (!StringUtil.isBlank(args)) {
hcmd = args; hcmd = args;
int sidx = args.indexOf(" "); int sidx = args.indexOf(" ");
if (sidx != -1) { if (sidx != -1) {
@@ -1150,7 +1150,7 @@ public class ChatDirector extends BasicDirector
public String handleCommand ( public String handleCommand (
SpeakService speakSvc, String command, String args, String[] history) SpeakService speakSvc, String command, String args, String[] history)
{ {
if (StringUtil.blank(args)) { if (StringUtil.isBlank(args)) {
return "m.usage_speak"; return "m.usage_speak";
} }
// note the command to be stored in the history // note the command to be stored in the history
@@ -1165,7 +1165,7 @@ public class ChatDirector extends BasicDirector
public String handleCommand ( public String handleCommand (
SpeakService speakSvc, String command, String args, String[] history) SpeakService speakSvc, String command, String args, String[] history)
{ {
if (StringUtil.blank(args)) { if (StringUtil.isBlank(args)) {
return "m.usage_emote"; return "m.usage_emote";
} }
// note the command to be stored in the history // note the command to be stored in the history
@@ -1180,7 +1180,7 @@ public class ChatDirector extends BasicDirector
public String handleCommand ( public String handleCommand (
SpeakService speakSvc, String command, String args, String[] history) SpeakService speakSvc, String command, String args, String[] history)
{ {
if (StringUtil.blank(args)) { if (StringUtil.isBlank(args)) {
return "m.usage_think"; return "m.usage_think";
} }
// note the command to be stored in the history // note the command to be stored in the history
@@ -136,7 +136,7 @@ public class ChatProvider
idle = System.currentTimeMillis() - tobj.statusTime; idle = System.currentTimeMillis() - tobj.statusTime;
} }
String awayMessage = null; String awayMessage = null;
if (!StringUtil.blank(tobj.awayMessage)) { if (!StringUtil.isBlank(tobj.awayMessage)) {
awayMessage = tobj.awayMessage; awayMessage = tobj.awayMessage;
} }
listener.tellSucceeded(idle, awayMessage); listener.tellSucceeded(idle, awayMessage);
+1 -1
View File
@@ -460,7 +460,7 @@ public class JmeApp
{ {
String cfgdir = ".narya"; String cfgdir = ".narya";
String home = System.getProperty("user.home"); String home = System.getProperty("user.home");
if (!StringUtil.blank(home)) { if (!StringUtil.isBlank(home)) {
cfgdir = home + File.separator + cfgdir; cfgdir = home + File.separator + cfgdir;
} }
// create the configuration directory if it does not already exist // create the configuration directory if it does not already exist
@@ -117,12 +117,12 @@ public class IconManager
// load it up if not // load it up if not
if (set == null) { if (set == null) {
String path = _config.getProperty(iconSet + PATH_SUFFIX); String path = _config.getProperty(iconSet + PATH_SUFFIX);
if (StringUtil.blank(path)) { if (StringUtil.isBlank(path)) {
throw new Exception("No path specified for icon set"); throw new Exception("No path specified for icon set");
} }
String metstr = _config.getProperty(iconSet + METRICS_SUFFIX); String metstr = _config.getProperty(iconSet + METRICS_SUFFIX);
if (StringUtil.blank(metstr)) { if (StringUtil.isBlank(metstr)) {
throw new Exception("No metrics specified for icon set"); throw new Exception("No metrics specified for icon set");
} }
@@ -179,7 +179,7 @@ public class ImageManager
public BufferedImage getImage (String rset, String path, public BufferedImage getImage (String rset, String path,
Colorization[] zations) Colorization[] zations)
{ {
if (StringUtil.blank(path)) { if (StringUtil.isBlank(path)) {
String errmsg = "Invalid image path [rset=" + rset + String errmsg = "Invalid image path [rset=" + rset +
", path=" + path + "]"; ", path=" + path + "]";
throw new IllegalArgumentException(errmsg); throw new IllegalArgumentException(errmsg);
@@ -548,7 +548,7 @@ public class SoundManager
*/ */
protected boolean isTesting () protected boolean isTesting ()
{ {
return !StringUtil.blank(_testDir.getValue()); return !StringUtil.isBlank(_testDir.getValue());
} }
/** /**
@@ -608,7 +608,7 @@ public class SoundManager
protected InputStream getTestClip (SoundKey key) protected InputStream getTestClip (SoundKey key)
{ {
String testDirectory = _testDir.getValue(); String testDirectory = _testDir.getValue();
if (StringUtil.blank(testDirectory)) { if (StringUtil.isBlank(testDirectory)) {
return null; return null;
} }
@@ -101,14 +101,14 @@ public abstract class TileSetRuleSet
boolean valid = true; boolean valid = true;
// check for the 'name' attribute // check for the 'name' attribute
if (StringUtil.blank(set.getName())) { if (StringUtil.isBlank(set.getName())) {
Log.warning("Tile set definition missing 'name' attribute " + Log.warning("Tile set definition missing 'name' attribute " +
"[set=" + set + "]."); "[set=" + set + "].");
valid = false; valid = false;
} }
// check for an <imagePath> element // check for an <imagePath> element
if (StringUtil.blank(set.getImagePath())) { if (StringUtil.isBlank(set.getImagePath())) {
Log.warning("Tile set definition missing <imagePath> element " + Log.warning("Tile set definition missing <imagePath> element " +
"[set=" + set + "]."); "[set=" + set + "].");
valid = false; valid = false;
@@ -94,7 +94,7 @@ public class LobbyConfig extends PlaceConfig
throws Exception throws Exception
{ {
String value = config.getProperty(key); String value = config.getProperty(key);
if (StringUtil.blank(value)) { if (StringUtil.isBlank(value)) {
throw new Exception("Missing '" + key + "' definition in " + throw new Exception("Missing '" + key + "' definition in " +
"lobby configuration."); "lobby configuration.");
} }
@@ -1,5 +1,5 @@
// //
// $Id: LobbyManager.java,v 1.8 2004/08/27 02:12:50 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -57,7 +57,7 @@ public class LobbyManager extends PlaceManager
throws Exception throws Exception
{ {
String value = config.getProperty(key); String value = config.getProperty(key);
if (StringUtil.blank(value)) { if (StringUtil.isBlank(value)) {
throw new Exception("Missing '" + key + "' definition in " + throw new Exception("Missing '" + key + "' definition in " +
"lobby configuration."); "lobby configuration.");
} }
@@ -135,7 +135,7 @@ public class LobbyRegistry
// get the lobby manager class and UGI // get the lobby manager class and UGI
String cfgClass = props.getProperty("config"); String cfgClass = props.getProperty("config");
if (StringUtil.blank(cfgClass)) { if (StringUtil.isBlank(cfgClass)) {
throw new Exception("Missing 'config' definition in " + throw new Exception("Missing 'config' definition in " +
"lobby configuration."); "lobby configuration.");
} }
@@ -1033,7 +1033,7 @@ public class MisoScenePanel extends VirtualMediaPanel
String action = scobj.info.action; String action = scobj.info.action;
// if the object has no action, skip it // if the object has no action, skip it
if (StringUtil.blank(action)) { if (StringUtil.isBlank(action)) {
continue; continue;
} }
@@ -1165,7 +1165,7 @@ public class MisoScenePanel extends VirtualMediaPanel
*/ */
protected boolean skipHitObject (SceneObject scobj) protected boolean skipHitObject (SceneObject scobj)
{ {
return StringUtil.blank(scobj.info.action); return StringUtil.isBlank(scobj.info.action);
} }
/** /**
@@ -1,5 +1,5 @@
// //
// $Id: ObjectActionHandler.java,v 1.3 2004/08/27 02:20:06 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -89,7 +89,7 @@ public class ObjectActionHandler
*/ */
public static String getType (String command) public static String getType (String command)
{ {
int cidx = StringUtil.blank(command) ? -1 : command.indexOf(':'); int cidx = StringUtil.isBlank(command) ? -1 : command.indexOf(':');
return (cidx == -1) ? "" : command.substring(0, cidx); return (cidx == -1) ? "" : command.substring(0, cidx);
} }
@@ -99,7 +99,7 @@ public class ObjectActionHandler
*/ */
public static String getAction (String command) public static String getAction (String command)
{ {
int cidx = StringUtil.blank(command) ? -1 : command.indexOf(':'); int cidx = StringUtil.isBlank(command) ? -1 : command.indexOf(':');
return (cidx == -1) ? command : command.substring(cidx+1); return (cidx == -1) ? command : command.substring(cidx+1);
} }
@@ -127,7 +127,7 @@ public class ObjectInfo extends SimpleStreamableObject
*/ */
public boolean isInteresting () public boolean isInteresting ()
{ {
return (!StringUtil.blank(action) || priority != 0 || return (!StringUtil.isBlank(action) || priority != 0 ||
sx != 0 || sy != 0 || zations != 0); sx != 0 || sy != 0 || zations != 0);
} }
@@ -90,7 +90,7 @@ public class FringeConfigurationParser extends CompiledConfigParser
for (int ii=0; ii < attrs.getLength(); ii++) { for (int ii=0; ii < attrs.getLength(); ii++) {
String name = attrs.getLocalName(ii); String name = attrs.getLocalName(ii);
if (StringUtil.blank(name)) { if (StringUtil.isBlank(name)) {
name = attrs.getQName(ii); name = attrs.getQName(ii);
} }
String value = attrs.getValue(ii); String value = attrs.getValue(ii);
@@ -139,7 +139,7 @@ public class FringeConfigurationParser extends CompiledConfigParser
for (int ii=0; ii < attrs.getLength(); ii++) { for (int ii=0; ii < attrs.getLength(); ii++) {
String name = attrs.getLocalName(ii); String name = attrs.getLocalName(ii);
if (StringUtil.blank(name)) { if (StringUtil.isBlank(name)) {
name = attrs.getQName(ii); name = attrs.getQName(ii);
} }
String value = attrs.getValue(ii); String value = attrs.getValue(ii);
@@ -1,5 +1,5 @@
// //
// $Id: SimpleMisoSceneParser.java,v 1.3 2004/08/27 02:20:09 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -49,7 +49,7 @@ public class SimpleMisoSceneParser
SimpleMisoSceneRuleSet set = new SimpleMisoSceneRuleSet(); SimpleMisoSceneRuleSet set = new SimpleMisoSceneRuleSet();
// configure our top-level path prefix // configure our top-level path prefix
if (StringUtil.blank(prefix)) { if (StringUtil.isBlank(prefix)) {
_prefix = set.getOuterElement(); _prefix = set.getOuterElement();
} else { } else {
_prefix = prefix + "/" + set.getOuterElement(); _prefix = prefix + "/" + set.getOuterElement();
@@ -1,5 +1,5 @@
// //
// $Id: SimpleMisoSceneWriter.java,v 1.2 2004/08/27 02:20:09 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -87,7 +87,7 @@ public class SimpleMisoSceneWriter implements NestableWriter
attrs.addAttribute("", "x", "", "", String.valueOf(info.x)); attrs.addAttribute("", "x", "", "", String.valueOf(info.x));
attrs.addAttribute("", "y", "", "", String.valueOf(info.y)); attrs.addAttribute("", "y", "", "", String.valueOf(info.y));
if (!StringUtil.blank(info.action)) { if (!StringUtil.isBlank(info.action)) {
attrs.addAttribute("", "action", "", "", info.action); attrs.addAttribute("", "action", "", "", info.action);
} }
@@ -1,5 +1,5 @@
// //
// $Id: SparseMisoSceneParser.java,v 1.4 2004/08/27 02:20:09 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -50,7 +50,7 @@ public class SparseMisoSceneParser
SparseMisoSceneRuleSet set = new SparseMisoSceneRuleSet(); SparseMisoSceneRuleSet set = new SparseMisoSceneRuleSet();
// configure our top-level path prefix // configure our top-level path prefix
if (StringUtil.blank(prefix)) { if (StringUtil.isBlank(prefix)) {
_prefix = set.getOuterElement(); _prefix = set.getOuterElement();
} else { } else {
_prefix = prefix + "/" + set.getOuterElement(); _prefix = prefix + "/" + set.getOuterElement();
@@ -1,5 +1,5 @@
// //
// $Id: SparseMisoSceneWriter.java,v 1.4 2004/08/27 02:20:09 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -102,7 +102,7 @@ public class SparseMisoSceneWriter implements NestableWriter
attrs.addAttribute("", "x", "", "", String.valueOf(info.x)); attrs.addAttribute("", "x", "", "", String.valueOf(info.x));
attrs.addAttribute("", "y", "", "", String.valueOf(info.y)); attrs.addAttribute("", "y", "", "", String.valueOf(info.y));
if (!StringUtil.blank(info.action)) { if (!StringUtil.isBlank(info.action)) {
attrs.addAttribute("", "action", "", "", info.action); attrs.addAttribute("", "action", "", "", info.action);
} }
if (info.priority != 0) { if (info.priority != 0) {
@@ -307,13 +307,13 @@ public class GenDObjectTask extends Task
} }
if (fsection.length() > 0) { if (fsection.length() > 0) {
String prev = get(lines, nstart-1); String prev = get(lines, nstart-1);
if (!StringUtil.blank(prev) && !prev.equals("{")) { if (!StringUtil.isBlank(prev) && !prev.equals("{")) {
bout.newLine(); bout.newLine();
} }
writeln(bout, " " + FIELDS_START); writeln(bout, " " + FIELDS_START);
bout.write(fsection.toString()); bout.write(fsection.toString());
writeln(bout, " " + FIELDS_END); writeln(bout, " " + FIELDS_END);
if (!StringUtil.blank(get(lines, nend))) { if (!StringUtil.isBlank(get(lines, nend))) {
bout.newLine(); bout.newLine();
} }
} }
@@ -322,14 +322,14 @@ public class GenDObjectTask extends Task
} }
if (msection.length() > 0) { if (msection.length() > 0) {
if (!StringUtil.blank(get(lines, mstart-1))) { if (!StringUtil.isBlank(get(lines, mstart-1))) {
bout.newLine(); bout.newLine();
} }
writeln(bout, " " + METHODS_START); writeln(bout, " " + METHODS_START);
bout.write(msection.toString()); bout.write(msection.toString());
writeln(bout, " " + METHODS_END); writeln(bout, " " + METHODS_END);
String next = get(lines, mend); String next = get(lines, mend);
if (!StringUtil.blank(next) && !next.equals("}")) { if (!StringUtil.isBlank(next) && !next.equals("}")) {
bout.newLine(); bout.newLine();
} }
} }
@@ -98,9 +98,9 @@ public class Handler extends URLStreamHandler
try { try {
// if there are query parameters, we need special magic // if there are query parameters, we need special magic
String query = url.getQuery(); String query = url.getQuery();
if (!StringUtil.blank(query)) { if (!StringUtil.isBlank(query)) {
_stream = getStream(bundle, path, query); _stream = getStream(bundle, path, query);
} else if (StringUtil.blank(bundle)) { } else if (StringUtil.isBlank(bundle)) {
_stream = _rmgr.getResource(path); _stream = _rmgr.getResource(path);
} else { } else {
_stream = _rmgr.getResource(bundle, path); _stream = _rmgr.getResource(bundle, path);
@@ -177,7 +177,7 @@ public class Handler extends URLStreamHandler
// locate the tile image, then write that subimage back out in PNG // locate the tile image, then write that subimage back out in PNG
// format into memory and return an input stream for that // format into memory and return an input stream for that
ImageInputStream stream = ImageInputStream stream =
StringUtil.blank(bundle) ? _rmgr.getImageResource(path) StringUtil.isBlank(bundle) ? _rmgr.getImageResource(path)
: _rmgr.getImageResource(bundle, path); : _rmgr.getImageResource(bundle, path);
BufferedImage src = ImageIO.read(stream); BufferedImage src = ImageIO.read(stream);
Rectangle trect = GeomUtil.getTile( Rectangle trect = GeomUtil.getTile(
@@ -176,10 +176,10 @@ public class EditorApp implements Runnable
public static String localDataDir (String subdir) public static String localDataDir (String subdir)
{ {
String appdir = System.getProperty("appdir"); String appdir = System.getProperty("appdir");
if (StringUtil.blank(appdir)) { if (StringUtil.isBlank(appdir)) {
appdir = ".narya-editor"; appdir = ".narya-editor";
String home = System.getProperty("user.home"); String home = System.getProperty("user.home");
if (!StringUtil.blank(home)) { if (!StringUtil.isBlank(home)) {
appdir = home + File.separator + appdir; appdir = home + File.separator + appdir;
} }
} }
@@ -142,7 +142,7 @@ public class ObjectEditorDialog extends JInternalFrame
protected Object[] computeZations (String[] zations, int index) protected Object[] computeZations (String[] zations, int index)
{ {
if (zations.length <= index || StringUtil.blank(zations[index])) { if (zations.length <= index || StringUtil.isBlank(zations[index])) {
return null; return null;
} }
ColorPository cpos = _ctx.getColorPository(); ColorPository cpos = _ctx.getColorPository();
@@ -150,7 +150,7 @@ public class MessageManager
String mbclass = null; String mbclass = null;
try { try {
mbclass = rbundle.getString(MBUNDLE_CLASS_KEY); mbclass = rbundle.getString(MBUNDLE_CLASS_KEY);
if (!StringUtil.blank(mbclass)) { if (!StringUtil.isBlank(mbclass)) {
bundle = (MessageBundle) bundle = (MessageBundle)
Class.forName(mbclass).newInstance(); Class.forName(mbclass).newInstance();
} }
@@ -1,5 +1,5 @@
// //
// $Id: SceneParser.java,v 1.3 2004/08/27 02:20:48 mdb Exp $ // $Id$
// //
// Narya library - tools for developing networked games // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
@@ -50,7 +50,7 @@ public class SceneParser
SceneRuleSet set = createSceneRuleSet(); SceneRuleSet set = createSceneRuleSet();
// configure our top-level path prefix // configure our top-level path prefix
if (StringUtil.blank(prefix)) { if (StringUtil.isBlank(prefix)) {
_prefix = set.getOuterElement(); _prefix = set.getOuterElement();
} else { } else {
_prefix = prefix + "/" + set.getOuterElement(); _prefix = prefix + "/" + set.getOuterElement();