public static Entity decode( ParsedXML node, Game game ) {
public static Entity decode( ParsedXML node, IGame game ) {
    public static Entity decode( ParsedXML node, Game game ) {        Protomech entity = null;        String attrStr;        int attrVal;        int loc;        // Did we get a null node?        if ( null == node ) {            throw new IllegalArgumentException( "The Protomech node is null." );        }        // Make sure that the node is for an Protomech unit.        attrStr = node.getAttribute( "name" );        if ( !node.getName().equals( "class" ) ||             null == attrStr || !attrStr.equals( "Protomech" ) ) {            throw new IllegalStateException( "Not passed an Protomech node." );        }        // TODO : perform version checking.        // Create the entity.        entity = new Protomech();        // Walk the board node's children.        Enumeration children = node.elements();        while ( children.hasMoreElements() ) {            ParsedXML child = (ParsedXML) children.nextElement();            String childName = child.getName();            // Handle null child names.            if ( null == childName ) {                // No-op.            }            // Did we find the BV node?            else if ( childName.equals( "bv" ) ) {                // Get the Proto's BV.                attrStr = child.getAttribute( "value" );                if ( null == attrStr ) {                    throw new IllegalStateException                        ( "Couldn't decode the BV for a Protomech unit." );                }                // Try to pull the number from the attribute string                try {                    attrVal = Integer.parseInt( attrStr );                }                catch ( NumberFormatException exp ) {                    throw new IllegalStateException                        ( "Couldn't get an integer from " + attrStr );                }                entity.setBattleValue( attrVal );            }            // Did we find the main gun node?            else if ( childName.equals( "hasMainGun" ) ) {                // See if the Proto has a main gun.                attrStr = child.getAttribute( "value" );                if ( null == attrStr ) {                    throw new IllegalStateException                        ( "Couldn't decode hasMainGun for a Protomech unit." );                }                // If the value is "true", the Proto has a main gun.                if ( attrStr.equals( "true" ) ) {                    entity.setHasMainGun( true );                } else {                    entity.setHasMainGun( false );                }            }            // Did we find the location-specific pilot damage node?            else if ( childName.equals( "pilotDamageTaken" ) ) {                // Get the damage taken by the pilot in this location.                attrStr = child.getAttribute( "value" );                if ( null == attrStr ) {                    throw new IllegalStateException                        ( "Couldn't decode the damage for a Protomech unit." );                }                // Try to pull the number from the attribute string                try {                    attrVal = Integer.parseInt( attrStr );                }                catch ( NumberFormatException exp ) {                    throw new IllegalStateException                        ( "Couldn't get an integer from " + attrStr );                }                // Get this location.                attrStr = child.getAttribute( "loc" );                if ( null == attrStr ) {                    throw new IllegalStateException                        ( "Couldn't decode the location for a Protomech unit." );                }                // Try to pull the number from the attribute string                try {                    loc = Integer.parseInt( attrStr );                }                catch ( NumberFormatException exp ) {                    throw new IllegalStateException                        ( "Couldn't get an integer from " + attrStr );                }                entity.setPilotDamageTaken( loc, attrVal );            }        } // Handle the next element.        // Return the entity.        return entity;    }