add tinyv1/2 parsers + writers, add mapping merging + flattening, fix bugs #3

Merged
Ecorous merged 4 commits from owlsys/tiny-mappings into main 2024-07-04 14:39:23 -04:00
Showing only changes of commit 9a1f48345f - Show all commits

View file

@ -31,14 +31,15 @@ public record MappingBundle(List<MappingData> data, List<DocumentationData> docu
return list;
}
public static MappingBundle merge(MappingBundle a, MappingBundle b) {
public static MappingBundle merge(MappingBundle... bundles) {
List<MappingData> mergedData = new ArrayList<>();
mergedData.addAll(a.data());
mergedData.addAll(b.data());
List<DocumentationData> mergedDocs = new ArrayList<>();
mergedDocs.addAll(a.documentation());
mergedDocs.addAll(b.documentation());
for (MappingBundle bundle : bundles) {
mergedData.addAll(bundle.data());
mergedDocs.addAll(bundle.documentation());
}
return new MappingBundle(mergedData, mergedDocs);
}
@ -68,14 +69,6 @@ public record MappingBundle(List<MappingData> data, List<DocumentationData> docu
}
public MappingData forNamespaces(String src, String dst) {
/*List<MappingData> matching = new ArrayList<>();
for (MappingData datum : data) {
if (!datum.dstNamespace().equals(src) && !datum.srcNamespace().equals(dst)) { // cut the graph so it has new ends
matching.add(datum);
}
}
return new MappingBundle(matching, documentation).flatten(src, dst);*/
return flatten(src, dst);
}