private static Entity decodeEntityData( ParsedXML node, Game game ) {
private static Entity decodeEntityData( ParsedXML node, IGame game ) {
    private static Entity decodeEntityData( ParsedXML node, Game game ) {        String attrStr = null;        int attrVal = 0;        boolean attrTrue = false;        Entity entity = null;        Coords coords = null;        ParsedXML actionNode = null;        ParsedXML narcNode = null;        ParsedXML infernoNode = null;        ParsedXML loadedUnitsNode = null;        // Did we get a null node?        if ( null == node ) {            throw new IllegalArgumentException( "The entityData is null." );        }        // Make sure that the node is for a EntityData object.        if ( !node.getName().equals( "entityData" ) ) {            throw new IllegalStateException( "Not passed a entityData node." );        }        // TODO : perform version checking.        // Walk the entityData 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 coords node?            else if ( childName.equals("coords") ) {                // We can decode the coords immediately.                coords = CoordsEncoder.decode( child, game );            } // End found-"coords"-child            // Did we find the action node?            // TODO : rename me            else if ( childName.equals("action") ) {                // Save the action node for later decoding.                actionNode = child;            } // End found-"action"-child            // Did we find the narcs node?            else if ( childName.equals("narcs") ) {                // Save the narc node for later decoding.                narcNode = child;            } // End found-"narc"-child            // Did we find the inferno node?            else if ( childName.equals("inferno") ) {                // Save the inferno node for later decoding.                infernoNode = child;            } // End found-"inferno"-child            // Did we find the loadedUnits node?            else if ( childName.equals("loadedUnits") ) {                // Save the loadedUnits node for later decoding.                loadedUnitsNode = child;            } // End found-"loadedUnits"-child            // Did we find the class node?            else if ( childName.equals("class") ) {                // Create the appropriate sub-class of Entity.                attrStr = child.getAttribute( "name" );                if ( null == attrStr ) {                    throw new IllegalStateException                        ( "Couldn't decode the name of a class node." );                }                else if ( attrStr.equals("BipedMech") ) {                    entity = BipedMechEncoder.decode( child, game );                }                else if ( attrStr.equals("QuadMech") ) {                    entity = QuadMechEncoder.decode( child, game );                }                else if ( attrStr.equals("Tank") ) {                    entity = TankEncoder.decode( child, game );                }                else if ( attrStr.equals("BattleArmor") ) {                    entity = BattleArmorEncoder.decode( child, game );                }                else if ( attrStr.equals("Infantry") ) {                    entity = InfantryEncoder.decode( child, game );                }                else if ( attrStr.equals("Protomech") ) {                    entity = ProtomechEncoder.decode( child, game );                }                else {                    throw new IllegalStateException                        ( "Unexpected name for a class node: " + attrStr );                }            } // End found-"class"-child        } // Look at the next child.        // Did we find the entity yet?        if ( null == entity ) {            throw new IllegalStateException                ( "Couldn't locate the class for an entityData node." );        }        // Decode the inferno node.        EntityEncoder.decodeInferno( infernoNode, entity );        // TODO : a whole lot more decoding needed.        return entity;    }