From ebe3c16c93e53988d073f5362e321138a2e03a60 Mon Sep 17 00:00:00 2001 From: Markus Frohme Date: Mon, 26 Aug 2024 20:55:27 +0200 Subject: [PATCH] add convenience function --- .../xml/ra/RegisterAutomatonImporter.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/serialization/xml/src/main/java/net/automatalib/serialization/xml/ra/RegisterAutomatonImporter.java b/serialization/xml/src/main/java/net/automatalib/serialization/xml/ra/RegisterAutomatonImporter.java index ac8bb1d39..c0932e77e 100644 --- a/serialization/xml/src/main/java/net/automatalib/serialization/xml/ra/RegisterAutomatonImporter.java +++ b/serialization/xml/src/main/java/net/automatalib/serialization/xml/ra/RegisterAutomatonImporter.java @@ -18,6 +18,7 @@ import java.io.InputStream; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.LinkedHashMap; @@ -85,6 +86,18 @@ public class RegisterAutomatonImporter { public Collection> getDataTypes() { return typeMap.values(); } + public Collection> getDataTypes(Class clazz) { + final Collection> values = this.typeMap.values(); + final List> result = new ArrayList<>(values.size()); + + for (DataType value : values) { + if (value.getBase().equals(clazz)) { + result.add((DataType) value); + } + } + + return result; + } public RegisterAutomatonImporter(InputStream is) { loadModel(is);