<commit_before>package org.openlca.geo.multi;

import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.List;

import de.micromata.opengis.kml.v_2_2_0.Feature;
import de.micromata.opengis.kml.v_2_2_0.Folder;
import de.micromata.opengis.kml.v_2_2_0.Geometry;
import de.micromata.opengis.kml.v_2_2_0.Kml;
import de.micromata.opengis.kml.v_2_2_0.MultiGeometry;
import de.micromata.opengis.kml.v_2_2_0.Placemark;

public class MultiGeometryParser {

	public List<Geometry> parse(String kmlInput) {
		Kml kml = Kml.unmarshal(new ByteArrayInputStream(kmlInput.getBytes()));
		Folder folder = (Folder) kml.getFeature();
		if (folder.getFeature().size() == 0)
			return new ArrayList<>();
		Feature feature = folder.getFeature().get(0);
		if (!(feature instanceof Placemark))
			return new ArrayList<>();
		Placemark pm = (Placemark) feature;
		if (!(pm.getGeometry() instanceof MultiGeometry))
			return new ArrayList<>();
		MultiGeometry geometry = (MultiGeometry) pm.getGeometry();		
		return geometry.getGeometry();
	}
}<commit_msg>Fixed error in multi geometry parser <commit_after>package org.openlca.geo.multi;

import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.List;

import de.micromata.opengis.kml.v_2_2_0.Document;
import de.micromata.opengis.kml.v_2_2_0.Feature;
import de.micromata.opengis.kml.v_2_2_0.Folder;
import de.micromata.opengis.kml.v_2_2_0.Geometry;
import de.micromata.opengis.kml.v_2_2_0.Kml;
import de.micromata.opengis.kml.v_2_2_0.MultiGeometry;
import de.micromata.opengis.kml.v_2_2_0.Placemark;

public class MultiGeometryParser {

	public List<Geometry> parse(String kmlInput) {
		Kml kml = Kml.unmarshal(new ByteArrayInputStream(kmlInput.getBytes()));
		Feature feature = getFeature(kml);
		if (!(feature instanceof Placemark))
			return new ArrayList<>();
		Placemark pm = (Placemark) feature;
		if (!(pm.getGeometry() instanceof MultiGeometry))
			return new ArrayList<>();
		MultiGeometry geometry = (MultiGeometry) pm.getGeometry();
		return geometry.getGeometry();
	}

	private Feature getFeature(Kml kml) {
		if (kml.getFeature() instanceof Folder) {
			Folder folder = (Folder) kml.getFeature();
			if (folder.getFeature().size() == 0)
				return null;
			return folder.getFeature().get(0);
		} else if (kml.getFeature() instanceof Document) {
			Document document = (Document) kml.getFeature();
			if (document.getFeature().size() == 0)
				return null;
			return document.getFeature().get(0);
		}
		return null;
	}
	
}
{'fraction_non_alphanumeric': 0.1296370163542082, 'fraction_numerical': 0.017949740725967292, 'mean_word_length': 5.147058823529412, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1089534', 'n_tokens_mistral': 947, 'n_tokens_neox': 882, 'n_words': 171}