Brought things up to date with the latest Jakarta Commons world order.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3058 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-07-13 16:34:49 +00:00
parent a6f57205d7
commit 1da753e14d
16 changed files with 119 additions and 138 deletions
@@ -1,5 +1,5 @@
//
// $Id: BaseTileSetRuleSet.java,v 1.10 2004/02/25 14:43:57 mdb Exp $
// $Id: BaseTileSetRuleSet.java,v 1.11 2004/07/13 16:34:49 mdb Exp $
package com.threerings.miso.tile.tools.xml;
@@ -28,8 +28,7 @@ public class BaseTileSetRuleSet extends SwissArmyTileSetRuleSet
super.addRuleInstances(digester);
digester.addRule(
_prefix + TILESET_PATH + "/passable",
new CallMethodSpecialRule(digester) {
_prefix + TILESET_PATH + "/passable", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
{
int[] values = StringUtil.parseIntArray(bodyText);
@@ -1,5 +1,5 @@
//
// $Id: FringeConfigurationParser.java,v 1.9 2004/02/25 14:43:57 mdb Exp $
// $Id: FringeConfigurationParser.java,v 1.10 2004/07/13 16:34:49 mdb Exp $
package com.threerings.miso.tile.tools.xml;
@@ -43,33 +43,30 @@ public class FringeConfigurationParser extends CompiledConfigParser
{
// configure top-level constraints
String prefix = "fringe";
digest.addRule(prefix, new SetPropertyFieldsRule(digest));
digest.addRule(prefix, new SetPropertyFieldsRule());
// create and configure fringe config instances
prefix += "/base";
digest.addObjectCreate(prefix, FringeRecord.class.getName());
// you'd better match parens if you have any hope of wading
// in these waters
digest.addRule(prefix,
new ValidatedSetNextRule(digest, "addFringeRecord",
new ValidatedSetNextRule.Validator () {
public boolean isValid (Object target) {
if (((FringeRecord) target).isValid()) {
return true;
} else {
Log.warning("A FringeRecord was not added " +
"because it was improperly specified " +
"[record=" + target + "].");
return false;
}
}
}) {
// parse the fringe record, converting tileset names to tileset
// ids
ValidatedSetNextRule.Validator val;
val = new ValidatedSetNextRule.Validator() {
public boolean isValid (Object target) {
if (((FringeRecord) target).isValid()) {
return true;
} else {
Log.warning("A FringeRecord was not added because it was " +
"improperly specified [rec=" + target + "].");
return false;
}
}
};
ValidatedSetNextRule vrule;
vrule = new ValidatedSetNextRule("addFringeRecord", val) {
// parse the fringe record, converting tileset names to
// tileset ids
public void begin (Attributes attrs)
throws Exception
throws Exception
{
FringeRecord frec = (FringeRecord) digester.peek();
@@ -96,27 +93,29 @@ public class FringeConfigurationParser extends CompiledConfigParser
}
}
}
});
};
digest.addRule(prefix, vrule);
// create the tileset records in each fringe record
prefix += "/tileset";
digest.addObjectCreate(prefix, FringeTileSetRecord.class.getName());
digest.addRule(prefix, new ValidatedSetNextRule(digest, "addTileset",
new ValidatedSetNextRule.Validator() {
public boolean isValid (Object target) {
if (((FringeTileSetRecord) target).isValid()) {
return true;
} else {
Log.warning("A FringeTileSetRecord was not added " +
"because it was improperly specified.");
return false;
}
val = new ValidatedSetNextRule.Validator() {
public boolean isValid (Object target) {
if (((FringeTileSetRecord) target).isValid()) {
return true;
} else {
Log.warning("A FringeTileSetRecord was not added because " +
"it was improperly specified " +
"[rec=" + target + "].");
return false;
}
}) {
}
};
vrule = new ValidatedSetNextRule("addTileset", val) {
// parse the fringe tilesetrecord, converting tileset names to ids
public void begin (Attributes attrs)
throws Exception
throws Exception
{
FringeTileSetRecord f = (FringeTileSetRecord) digester.peek();
@@ -143,7 +142,8 @@ public class FringeConfigurationParser extends CompiledConfigParser
}
}
}
});
};
digest.addRule(prefix, vrule);
}
protected TileSetIDBroker _idBroker;
@@ -1,5 +1,5 @@
//
// $Id: SimpleMisoSceneRuleSet.java,v 1.1 2003/02/12 07:21:50 mdb Exp $
// $Id: SimpleMisoSceneRuleSet.java,v 1.2 2004/07/13 16:34:49 mdb Exp $
package com.threerings.miso.tools.xml;
@@ -34,21 +34,22 @@ public class SimpleMisoSceneRuleSet implements NestableRuleSet
{
// this creates the appropriate instance when we encounter our
// prefix tag
dig.addRule(prefix, new Rule(dig) {
public void begin (Attributes attributes) throws Exception {
dig.addRule(prefix, new Rule() {
public void begin (String namespace, String name,
Attributes attributes) throws Exception {
digester.push(createMisoSceneModel());
}
public void end () throws Exception {
public void end (String namespace, String name) throws Exception {
digester.pop();
}
});
// set up rules to parse and set our fields
dig.addRule(prefix + "/width", new SetFieldRule(dig, "width"));
dig.addRule(prefix + "/height", new SetFieldRule(dig, "height"));
dig.addRule(prefix + "/viewwidth", new SetFieldRule(dig, "vwidth"));
dig.addRule(prefix + "/viewheight", new SetFieldRule(dig, "vheight"));
dig.addRule(prefix + "/base", new SetFieldRule(dig, "baseTileIds"));
dig.addRule(prefix + "/width", new SetFieldRule("width"));
dig.addRule(prefix + "/height", new SetFieldRule("height"));
dig.addRule(prefix + "/viewwidth", new SetFieldRule("vwidth"));
dig.addRule(prefix + "/viewheight", new SetFieldRule("vheight"));
dig.addRule(prefix + "/base", new SetFieldRule("baseTileIds"));
dig.addObjectCreate(prefix + "/objects", ArrayList.class.getName());
dig.addObjectCreate(prefix + "/objects/object",
@@ -56,10 +57,9 @@ public class SimpleMisoSceneRuleSet implements NestableRuleSet
dig.addSetNext(prefix + "/objects/object", "add",
Object.class.getName());
dig.addRule(prefix + "/objects/object",
new SetPropertyFieldsRule(dig));
dig.addRule(prefix + "/objects/object", new SetPropertyFieldsRule());
dig.addRule(prefix + "/objects", new CallMethodSpecialRule(dig) {
dig.addRule(prefix + "/objects", new CallMethodSpecialRule() {
public void parseAndSet (String bodyText, Object target)
throws Exception
{
@@ -1,5 +1,5 @@
//
// $Id: SparseMisoSceneRuleSet.java,v 1.3 2004/02/25 14:43:57 mdb Exp $
// $Id: SparseMisoSceneRuleSet.java,v 1.4 2004/07/13 16:34:49 mdb Exp $
package com.threerings.miso.tools.xml;
@@ -33,29 +33,28 @@ public class SparseMisoSceneRuleSet implements NestableRuleSet
{
// this creates the appropriate instance when we encounter our
// prefix tag
dig.addRule(prefix, new Rule(dig) {
public void begin (Attributes attributes) throws Exception {
dig.addRule(prefix, new Rule() {
public void begin (String namespace, String name,
Attributes attributes) throws Exception {
digester.push(createMisoSceneModel());
}
public void end () throws Exception {
public void end (String namespace, String name) throws Exception {
digester.pop();
}
});
// set up rules to parse and set our fields
dig.addRule(prefix + "/swidth", new SetFieldRule(dig, "swidth"));
dig.addRule(prefix + "/sheight", new SetFieldRule(dig, "sheight"));
dig.addRule(prefix + "/defTileSet",
new SetFieldRule(dig, "defTileSet"));
dig.addRule(prefix + "/swidth", new SetFieldRule("swidth"));
dig.addRule(prefix + "/sheight", new SetFieldRule("sheight"));
dig.addRule(prefix + "/defTileSet", new SetFieldRule("defTileSet"));
String sprefix = prefix + "/sections/section";
dig.addObjectCreate(sprefix, Section.class.getName());
dig.addRule(sprefix, new SetPropertyFieldsRule(dig));
dig.addRule(sprefix + "/base", new SetFieldRule(dig, "baseTileIds"));
dig.addRule(sprefix, new SetPropertyFieldsRule());
dig.addRule(sprefix + "/base", new SetFieldRule("baseTileIds"));
dig.addObjectCreate(sprefix + "/objects/object",
ObjectInfo.class.getName());
dig.addRule(sprefix + "/objects/object",
new SetPropertyFieldsRule(dig));
dig.addRule(sprefix + "/objects/object", new SetPropertyFieldsRule());
dig.addSetNext(sprefix + "/objects/object", "addObject",
ObjectInfo.class.getName());
dig.addSetNext(sprefix, "setSection", Section.class.getName());