Class TypeMapper
java.lang.Object
de.iip_ecosphere.platform.configuration.ivml.TypeMapper
Maps types to IVML.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilderprivate net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configurationprivate Set<net.ssehub.easy.varModel.model.Project> static final intstatic final intprivate Predicate<net.ssehub.easy.varModel.model.AbstractVariable> -
Constructor Summary
ConstructorsConstructorDescriptionTypeMapper(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration cfg, Predicate<net.ssehub.easy.varModel.model.AbstractVariable> variableFilter, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder builder, Function<String, String> metaShortId) Creates a type mapper instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidadd(Map<Integer, List<de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder>> src, List<de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> tgt, int start, int inc) Adds all entries fromsrcwith matching key totgt.(package private) static voidaddMetaDefault(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.AbstractVariable decl, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder varBuilder, Function<String, String> metaShortId) Adds the default value ofvarif there is a default value.(package private) static voidaddMetaDefault(net.ssehub.easy.varModel.confModel.IDecisionVariable var, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder varBuilder, Function<String, String> metaShortId) Adds the default value ofvarif there is a default value.static voidaddTypeKind(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder typeB, IvmlTypeKind kind, Function<String, String> metaShortId) Adds an AAS type kind property.static voidaddTypeKind(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder typeB, net.ssehub.easy.varModel.model.datatypes.IDatatype type, Function<String, String> metaShortId) Adds an AAS type kind property.private voidcollectMemberNames(net.ssehub.easy.varModel.model.datatypes.Compound type, List<String> result, Set<String> done) Collects the member names for type.private voidcollectMemberNamesContainer(net.ssehub.easy.varModel.model.IDecisionVariableContainer cnt, List<String> result, Set<String> done) Collects the member names for the given container.private ObjectgetAssignmentValue(String name) Returns the top-most collected assignment value.private static StringgetRefines(net.ssehub.easy.varModel.model.datatypes.Compound type) Returns the refined type oftypeas comma-separated string list.intgetUiGroup(String type, String slot) Returns the recorded UI group.private booleanisDoneType(String typeId) Returns whethertypeIdrepresents a done type (indoneTypes).private voidmapCompoundSlot(net.ssehub.easy.varModel.model.DecisionVariableDeclaration slot, net.ssehub.easy.varModel.model.datatypes.Compound type, net.ssehub.easy.varModel.model.datatypes.Compound topType, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, Map<String, de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> doneSlots) Map a compound slot.private voidmapCompoundSlots(net.ssehub.easy.varModel.model.IDecisionVariableContainer cnt, net.ssehub.easy.varModel.model.datatypes.Compound type, net.ssehub.easy.varModel.model.datatypes.Compound topType, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, Map<String, de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> doneSlots) Maps slots of a compound type including annotation assignments.private voidmapCompoundType(net.ssehub.easy.varModel.model.datatypes.Compound type) Maps a compound type.private voidmapDerivedType(net.ssehub.easy.varModel.model.datatypes.DerivedDatatype type) Maps a derived type.private voidmapEnumType(net.ssehub.easy.varModel.model.datatypes.Enum type) Maps an IVML enum type.private voidmapPrimitiveType(String name) Maps a primitive type.private voidmapRefines(net.ssehub.easy.varModel.model.datatypes.Compound type, net.ssehub.easy.varModel.model.datatypes.Compound topType, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, Map<String, de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> doneSlots) Maps refines of a compound type.(package private) voidmapType(net.ssehub.easy.varModel.model.datatypes.IDatatype type) Maps an IVML type.(package private) voidmapTypes()Maps all types.private voidmapTypes(net.ssehub.easy.varModel.model.Project project) Maps all types declared inprojectand imported projects.private List<de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> sortMembers(net.ssehub.easy.varModel.model.datatypes.Compound type, Map<String, de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> slots) Sort members for display sequence in UI.
-
Field Details
-
UIGROUP_SPACING
public static final int UIGROUP_SPACING- See Also:
-
UIGROUP_POS_FRONT
public static final int UIGROUP_POS_FRONT- See Also:
-
cfg
private net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration cfg -
doneProjects
-
doneTypes
-
builder
private de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder builder -
variableFilter
-
assignments
-
metaShortId
-
uiGroups
-
-
Constructor Details
-
TypeMapper
TypeMapper(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration cfg, Predicate<net.ssehub.easy.varModel.model.AbstractVariable> variableFilter, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder builder, Function<String, String> metaShortId) Creates a type mapper instance.- Parameters:
cfg- the configuration to map the declared types forvariableFilter- a variable filter to exclude certain variables/typesbuilder- the builder to place AAS elements intometaShortId- function to build a meta shortId property name
-
-
Method Details
-
mapTypes
void mapTypes()Maps all types. -
mapTypes
private void mapTypes(net.ssehub.easy.varModel.model.Project project) Maps all types declared inprojectand imported projects.- Parameters:
project- the project to map
-
mapPrimitiveType
Maps a primitive type.- Parameters:
name- the name of the primitive type.
-
addTypeKind
public static void addTypeKind(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder typeB, net.ssehub.easy.varModel.model.datatypes.IDatatype type, Function<String, String> metaShortId) Adds an AAS type kind property.- Parameters:
typeB- the type buildertype- the typemetaShortId- function to build a meta shortId property name
-
addTypeKind
public static void addTypeKind(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder typeB, IvmlTypeKind kind, Function<String, String> metaShortId) Adds an AAS type kind property.- Parameters:
typeB- the type builderkind- the type kindmetaShortId- function to build a meta shortId property name
-
mapCompoundType
private void mapCompoundType(net.ssehub.easy.varModel.model.datatypes.Compound type) Maps a compound type. May be called for duplicates but leads only to one entry.- Parameters:
type- the compound type
-
sortMembers
private List<de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> sortMembers(net.ssehub.easy.varModel.model.datatypes.Compound type, Map<String, de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> slots) Sort members for display sequence in UI.- Parameters:
type- the type to sort the members forslots- the SME builders per slot- Returns:
- the sorted members
-
add
private void add(Map<Integer, List<de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder>> src, List<de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> tgt, int start, int inc) Adds all entries fromsrcwith matching key totgt. Assumption: There are no holes between the groups.- Parameters:
src- source structuretgt- target structurestart- the start ui group/keyinc- the increment, terminate immediately after first transfer if0
-
collectMemberNames
private void collectMemberNames(net.ssehub.easy.varModel.model.datatypes.Compound type, List<String> result, Set<String> done) Collects the member names for type.- Parameters:
type- the compound typeresult- the resulting name sequencedone- the done names
-
collectMemberNamesContainer
private void collectMemberNamesContainer(net.ssehub.easy.varModel.model.IDecisionVariableContainer cnt, List<String> result, Set<String> done) Collects the member names for the given container.- Parameters:
cnt- the containerresult- the resulting name sequencedone- the done names
-
mapType
void mapType(net.ssehub.easy.varModel.model.datatypes.IDatatype type) Maps an IVML type. May be called for duplicates but leads only to one entry.- Parameters:
type- the IVML type
-
mapEnumType
private void mapEnumType(net.ssehub.easy.varModel.model.datatypes.Enum type) Maps an IVML enum type.- Parameters:
type- the type
-
isDoneType
- Parameters:
typeId- the type id to search for- Returns:
trueif the type is considered as done,falseelse
-
mapDerivedType
private void mapDerivedType(net.ssehub.easy.varModel.model.datatypes.DerivedDatatype type) Maps a derived type. May be called for duplicates but leads only to one entry.- Parameters:
type- the derived type
-
getRefines
Returns the refined type oftypeas comma-separated string list.- Parameters:
type- the type to refine- Returns:
- the refined types
-
mapRefines
private void mapRefines(net.ssehub.easy.varModel.model.datatypes.Compound type, net.ssehub.easy.varModel.model.datatypes.Compound topType, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, Map<String, de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> doneSlots) Maps refines of a compound type.- Parameters:
type- the typetopType- the top-level type the mapping started withtypeB- the type builderdoneSlots- already done slot names
-
mapCompoundSlots
private void mapCompoundSlots(net.ssehub.easy.varModel.model.IDecisionVariableContainer cnt, net.ssehub.easy.varModel.model.datatypes.Compound type, net.ssehub.easy.varModel.model.datatypes.Compound topType, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, Map<String, de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> doneSlots) Maps slots of a compound type including annotation assignments.- Parameters:
cnt- the container (compound or annotation assignment)type- the containing compound typetopType- the top-level type the mapping started withtypeB- the type builderdoneSlots- already done slot names
-
addMetaDefault
static void addMetaDefault(net.ssehub.easy.varModel.confModel.IDecisionVariable var, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder varBuilder, Function<String, String> metaShortId) Adds the default value ofvarif there is a default value.- Parameters:
var- the variable to take the default value fromvarBuilder- the variable builder to add the meta-value tometaShortId- function to build a meta shortId property name
-
addMetaDefault
static void addMetaDefault(net.ssehub.easy.varModel.confModel.Configuration cfg, net.ssehub.easy.varModel.model.AbstractVariable decl, de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder varBuilder, Function<String, String> metaShortId) Adds the default value ofvarif there is a default value.- Parameters:
cfg- the configuration to use for reasoning/expression evaluationdecl- the variable declaration to take the default value fromvarBuilder- the variable builder to add the meta-value tometaShortId- function to build a meta shortId property name
-
mapCompoundSlot
private void mapCompoundSlot(net.ssehub.easy.varModel.model.DecisionVariableDeclaration slot, net.ssehub.easy.varModel.model.datatypes.Compound type, net.ssehub.easy.varModel.model.datatypes.Compound topType, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, Map<String, de.iip_ecosphere.platform.support.aas.SubmodelElementList.SubmodelElementListBuilder> doneSlots) Map a compound slot.- Parameters:
slot- the slot to maptype- the containing compound typetopType- the top-level type the mapping started withtypeB- the type builderdoneSlots- already done slot names
-
getUiGroup
Returns the recorded UI group.- Parameters:
type- the type nameslot- the name of the slot withintype- Returns:
- the uiGroup value, defaults to 100
-
getAssignmentValue
Returns the top-most collected assignment value.- Parameters:
name- the name of the assignment variable- Returns:
- the value or null for none
-