add getTypes(), getName(), remain creation order

This commit is contained in:
Volker Berlin 2019-01-01 11:43:11 +01:00
parent 77977ba319
commit 53e7f88d1c

View File

@ -16,7 +16,11 @@
*/ */
package de.inetsoftware.jwebassembly.module; package de.inetsoftware.jwebassembly.module;
import java.util.HashMap; import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.Nonnull;
import de.inetsoftware.jwebassembly.wasm.StorageType; import de.inetsoftware.jwebassembly.wasm.StorageType;
@ -27,7 +31,7 @@ import de.inetsoftware.jwebassembly.wasm.StorageType;
*/ */
class TypeManager { class TypeManager {
private final HashMap<String, StructType> map = new HashMap<>(); private final Map<String, StructType> map = new LinkedHashMap<>();
/** /**
* Use the type in the output. * Use the type in the output.
@ -48,6 +52,16 @@ class TypeManager {
} }
} }
/**
* Get the registered types in numeric order.
*
* @return the types
*/
@Nonnull
Collection<StructType> getTypes() {
return map.values();
}
/** /**
* A reference to a type. * A reference to a type.
* *
@ -76,5 +90,13 @@ class TypeManager {
public int getCode() { public int getCode() {
return code; return code;
} }
/**
* Get the name of the Java type
* @return the name
*/
public String getName() {
return name;
}
} }
} }