nameBuf = null;  break; case AmmoType.T_ARROW_IV:  nameBuf = new StringBuffer( base.name ); index = base.internalName.lastIndexOf( "Ammo" ); nameBuf.insert( index, ' ' ); nameBuf.insert( index, this.name );  if ( this.name.endsWith("IV") ) { index = base.internalName.indexOf( "IV" ); nameBuf.deleteCharAt( index ); nameBuf.deleteCharAt( index ); nameBuf.deleteCharAt( index ); } munition.name = nameBuf.toString(); nameBuf = new StringBuffer( base.internalName ); index = base.internalName.lastIndexOf( "Ammo" ); nameBuf.insert( index, this.name ); munition.internalName = nameBuf.toString(); nameBuf = new StringBuffer( base.mepName ); index = base.mepName.lastIndexOf( "Ammo" ); nameBuf.insert( index, ' ' ); nameBuf.insert( index, this.name ); munition.mepName = nameBuf.toString(); nameBuf = new StringBuffer( base.mtfName ); index = base.mtfName.lastIndexOf( "Ammo" ); nameBuf.insert( index, ' ' ); nameBuf.insert( index, this.name ); munition.mtfName = nameBuf.toString(); nameBuf = new StringBuffer( base.tdbName ); index = base.internalName.lastIndexOf( "Ammo" ); nameBuf.insert( index, ' ' ); nameBuf.insert( index, this.name ); munition.tdbName = nameBuf.toString();
        public AmmoType createMunitionType( AmmoType base ) {            StringBuffer nameBuf;            String temp;            int index;            // Create an uninitialized munition object.            AmmoType munition = new AmmoType();            // Manipulate the base round's names, depending on ammoType.            switch ( base.ammoType ) {            case AmmoType.T_AC:                // Add the munition name to the beginning of the display name.                nameBuf = new StringBuffer( this.name );                nameBuf.append( " " );                nameBuf.append( base.name );                munition.name = nameBuf.toString();                // Add the munition name to the end of the TDB ammo name.                nameBuf = new StringBuffer( base.tdbName );                nameBuf.append( " - " );                nameBuf.append( this.name );                munition.tdbName = nameBuf.toString();                // The munition name appears in the middle of the other names.                nameBuf = new StringBuffer( base.internalName );                index = base.internalName.lastIndexOf( "Ammo" );                nameBuf.insert( index, ' ' );                nameBuf.insert( index, this.name );                munition.internalName = nameBuf.toString();                nameBuf = new StringBuffer( base.mepName );                index = base.mepName.lastIndexOf( "Ammo" );                nameBuf.insert( index, ' ' );                nameBuf.insert( index, this.name );                munition.mepName = nameBuf.toString();                nameBuf = new StringBuffer( base.mtfName );                index = base.mtfName.lastIndexOf( "Ammo" );                nameBuf.insert( index, ' ' );                nameBuf.insert( index, this.name );                munition.mtfName = nameBuf.toString();                nameBuf = null;                break;            case AmmoType.T_SRM:                // Add the munition name to the end of some of the ammo names.                nameBuf = new StringBuffer( " " );                nameBuf.append( this.name );                temp = nameBuf.toString();                nameBuf.insert( 0, " -" );                munition.internalName = base.internalName + temp;                munition.mepName = base.mepName + temp;                munition.tdbName = base.tdbName + nameBuf.toString();                temp = null;                // The munition name appears in the middle of the other names.                nameBuf = new StringBuffer( base.name );                index = base.name.lastIndexOf( "Ammo" );                nameBuf.insert( index, ' ' );                nameBuf.insert( index, this.name );                munition.name = nameBuf.toString();                nameBuf = new StringBuffer( base.mtfName );                index = base.mtfName.lastIndexOf( "Ammo" );                nameBuf.insert( index, ' ' );                nameBuf.insert( index, this.name );                munition.mtfName = nameBuf.toString();                nameBuf = null;                break;            case AmmoType.T_LRM:                // Add the munition name to the beginning of the display name.                nameBuf = new StringBuffer( this.name );                nameBuf.append( " " );                nameBuf.append( base.name );                munition.name = nameBuf.toString();                // Add the munition name to the end of some of the ammo names.                nameBuf = new StringBuffer( " " );                nameBuf.append( this.name );                temp = nameBuf.toString();                nameBuf.insert( 0, " -" );                munition.internalName = base.internalName + temp;                munition.mepName = base.mepName + temp;                munition.mtfName = base.mtfName + temp;                munition.tdbName = base.tdbName + nameBuf.toString();                temp = null;                break;            default:                throw new IllegalArgumentException                    ( "Don't know how to create munitions for " +                      base.ammoType );            }            // Assign our munition type.            munition.munitionType = this.type;            // Reduce base number of shots to reflect the munition's weight.            munition.shots = base.shots / this.weight;            // Assign techlevel of the munition type.            // TODO : find a non-hardcoded way of doing this.            if ( TechConstants.T_CLAN_LEVEL_2 == base.techType ) {                munition.techType = TechConstants.T_CLAN_LEVEL_2;            } else {                munition.techType = TechConstants.T_IS_LEVEL_2;            }            // Copy over all other values.            munition.damagePerShot = base.damagePerShot;            munition.rackSize = base.rackSize;            munition.ammoType = base.ammoType;            munition.bv = base.bv;            munition.flags = base.flags;            munition.hittable = base.hittable;            munition.explosive = base.explosive;            munition.toHitModifier = base.toHitModifier;            // Return the new munition.            return munition;        }