com.threerings.media.tile.tools.xml
Class SwissArmyTileSetRuleSet

java.lang.Object
  extended by org.apache.commons.digester.RuleSetBase
      extended by com.threerings.media.tile.tools.xml.TileSetRuleSet
          extended by com.threerings.media.tile.tools.xml.SwissArmyTileSetRuleSet
All Implemented Interfaces:
ValidatedSetNextRule.Validator, org.apache.commons.digester.RuleSet
Direct Known Subclasses:
BaseTileSetRuleSet, ObjectTileSetRuleSet

public class SwissArmyTileSetRuleSet
extends TileSetRuleSet

Parses SwissArmyTileSet instances from a tileset description. A swiss army tileset description looks like so: <tileset name="Sample Swiss Army Tileset"> <imagePath>path/to/image.png</imagePath> <!-- the widths (per row) of each tile in pixels --> <widths>64, 64, 64, 64</widths> <!-- the heights (per row) of each tile in pixels --> <heights>48, 48, 48, 64</heights> <!-- the number of tiles in each row --> <tileCounts>16, 5, 3, 10</tileCounts> <!-- the offset in pixels to the upper left tile --> <offsetPos>8, 8</offsetPos> <!-- the gap between tiles in pixels --> <gapSize>12, 12</gapSize> </tileset>


Field Summary
 
Fields inherited from class com.threerings.media.tile.tools.xml.TileSetRuleSet
TILESET_PATH
 
Constructor Summary
SwissArmyTileSetRuleSet()
           
 
Method Summary
 void addRuleInstances(org.apache.commons.digester.Digester digester)
          Adds the necessary rules to the digester to parse our tilesets.
 boolean isValid(Object target)
          The ruleset can be provided to a ValidatedSetNextRule to ensure that the tileset was fully parsed before doing something with it.
 
Methods inherited from class com.threerings.media.tile.tools.xml.TileSetRuleSet
getPath, setPrefix
 
Methods inherited from class org.apache.commons.digester.RuleSetBase
getNamespaceURI
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwissArmyTileSetRuleSet

public SwissArmyTileSetRuleSet()
Method Detail

addRuleInstances

public void addRuleInstances(org.apache.commons.digester.Digester digester)
Description copied from class: TileSetRuleSet
Adds the necessary rules to the digester to parse our tilesets. Derived classes should override this method, being sure to call the superclass method and then adding their own rule instances (which should register themselves relative to the _prefix member).

Specified by:
addRuleInstances in interface org.apache.commons.digester.RuleSet
Overrides:
addRuleInstances in class TileSetRuleSet

isValid

public boolean isValid(Object target)
Description copied from class: TileSetRuleSet
The ruleset can be provided to a ValidatedSetNextRule to ensure that the tileset was fully parsed before doing something with it.

Specified by:
isValid in interface ValidatedSetNextRule.Validator
Overrides:
isValid in class TileSetRuleSet


Copyright © 2011. All Rights Reserved.