<commit_before>/*
 * This file is part of ATLAS. It is subject to the license terms in
 * the LICENSE file found in the top-level directory of this distribution.
 * (Also available at http://www.apache.org/licenses/LICENSE-2.0.txt)
 * You may not use this file except in compliance with the License.
 */
package de.dfki.asr.atlas.convert;

import de.dfki.asr.atlas.cdi.annotations.AtlasExporter;
import de.dfki.asr.atlas.model.Asset;
import de.dfki.asr.atlas.model.Folder;
import de.dfki.asr.atlas.model.ListingFolder;

@AtlasExporter(contentType = "application/json", fileExtension = ".json", folderTypes = {"node"})
public class SubassetListingExporter implements ExportOperation<ListingFolder>{

	private ExportContext context;

	@Override
	public ListingFolder export(ExportContext context) {
		this.context = context;
		Folder root = context.getStartingFolder();
		ListingFolder assetListing = createListingFromFolder(root);
		for (Folder child : root.getChildFolders()) {
			convertFolder(child, assetListing);
		}
		return assetListing;
	}

	@Override
	public boolean canExportFolder(Folder folder) {
		return folder.getType().equals("node");
	}

	private void convertFolder(Folder currentFolder, ListingFolder parentAsset) {
		if (currentFolder.getType().equals("node")) {
			ListingFolder subasset = createListingFromFolder(currentFolder);
			parentAsset.getChildren().add(subasset);
			for (Folder child : currentFolder.getChildFolders()) {
				convertFolder(child, subasset);
			}
		}
	}

	private String buildURLForFolder(Folder folder) {
		return context.uriFor(folder).toString();
	}

	private ListingFolder createListingFromFolder(Folder folder) {
		ListingFolder subasset = new ListingFolder();
		subasset.setName(folder.getName());
		subasset.setUrl(buildURLForFolder(folder));
		return subasset;
	}
}
<commit_msg>SubassetListingExporter: transfer the local transform into ListingFolder<commit_after>/*
 * This file is part of ATLAS. It is subject to the license terms in
 * the LICENSE file found in the top-level directory of this distribution.
 * (Also available at http://www.apache.org/licenses/LICENSE-2.0.txt)
 * You may not use this file except in compliance with the License.
 */
package de.dfki.asr.atlas.convert;

import de.dfki.asr.atlas.cdi.annotations.AtlasExporter;
import de.dfki.asr.atlas.model.ArrayMatrix4f;
import de.dfki.asr.atlas.model.Folder;
import de.dfki.asr.atlas.model.ListingFolder;

@AtlasExporter(contentType = "application/json", fileExtension = ".json", folderTypes = {"node"})
public class SubassetListingExporter implements ExportOperation<ListingFolder>{

	private ExportContext context;

	@Override
	public ListingFolder export(ExportContext context) {
		this.context = context;
		Folder root = context.getStartingFolder();
		ListingFolder assetListing = createListingFromFolder(root);
		for (Folder child : root.getChildFolders()) {
			convertFolder(child, assetListing);
		}
		return assetListing;
	}

	@Override
	public boolean canExportFolder(Folder folder) {
		return folder.getType().equals("node");
	}

	private void convertFolder(Folder currentFolder, ListingFolder parentAsset) {
		if (currentFolder.getType().equals("node")) {
			ListingFolder subasset = createListingFromFolder(currentFolder);
			parentAsset.getChildren().add(subasset);
			for (Folder child : currentFolder.getChildFolders()) {
				convertFolder(child, subasset);
			}
		}
	}

	private String buildURLForFolder(Folder folder) {
		return context.uriFor(folder).toString();
	}

	private ListingFolder createListingFromFolder(Folder folder) {
		ListingFolder subasset = new ListingFolder();
		subasset.setName(folder.getName());
		subasset.setUrl(buildURLForFolder(folder));
		subasset.setTransform(readLocalTransform(folder));
		return subasset;
	}

	private ArrayMatrix4f readLocalTransform(Folder folder) {
		return ExporterUtils.readTransform(folder, "transform", context);
	}
}

{'fraction_non_alphanumeric': 0.10554561717352415, 'fraction_numerical': 0.001533350370559673, 'mean_word_length': 5.405891980360066, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6721266', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1160, 'n_words': 275}