Class TypeMapper
- java.lang.Object
-
- de.iip_ecosphere.platform.configuration.ivml.TypeMapper
-
class TypeMapper extends java.lang.ObjectMaps types to IVML.- Author:
- Holger Eichelberger, SSE
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Stack<java.util.Map<java.lang.String,java.lang.Object>>assignmentsprivate de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilderbuilderprivate net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configurationcfgprivate java.util.Set<net.ssehub.easy.varModel.model.Project>doneProjectsprivate java.util.Set<java.lang.String>doneTypesprivate java.util.function.Predicate<net.ssehub.easy.varModel.model.AbstractVariable>variableFilter
-
Constructor Summary
Constructors Constructor Description TypeMapper(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration cfg, java.util.function.Predicate<net.ssehub.easy.varModel.model.AbstractVariable> variableFilter, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder builder)Creates a type mapper instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddTypeKind(de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, IvmlTypeKind kind)Adds an AAS type kind property.private java.lang.ObjectgetAssignmentValue(java.lang.String name)Returns the top-most collected assignment value.private static java.lang.StringgetRefines(net.ssehub.easy.varModel.model.datatypes.Compound type)Returns the refined type oftypeas comma-separated string list.private booleanisDoneType(java.lang.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, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, java.util.Set<java.lang.String> doneSlots)Map a compound slot.private voidmapCompoundSlots(net.ssehub.easy.varModel.model.IDecisionVariableContainer cnt, net.ssehub.easy.varModel.model.datatypes.Compound type, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, java.util.Set<java.lang.String> doneSlots)Maps slots of a compound type including annotation assignments.private voidmapCompoundType(net.ssehub.easy.varModel.model.datatypes.Compound type)Maps a compound type into the SMEC .private voidmapDerivedType(net.ssehub.easy.varModel.model.datatypes.DerivedDatatype type)Maps a derived type into the SMEC .private voidmapEnumType(net.ssehub.easy.varModel.model.datatypes.Enum type)Maps an IVML enum type.private voidmapPrimitiveType(java.lang.String name)Maps a primitive type.private voidmapRefines(net.ssehub.easy.varModel.model.datatypes.Compound type, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, java.util.Set<java.lang.String> doneSlots)Maps refines of a compound type.(package private) voidmapType(net.ssehub.easy.varModel.model.datatypes.IDatatype type)Maps an IVML type into the SMEC .(package private) voidmapTypes()Maps all types.private voidmapTypes(net.ssehub.easy.varModel.model.Project project)Maps all types declared inprojectand imported projects.
-
-
-
Field Detail
-
cfg
private net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration cfg
-
doneProjects
private java.util.Set<net.ssehub.easy.varModel.model.Project> doneProjects
-
doneTypes
private java.util.Set<java.lang.String> doneTypes
-
builder
private de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder builder
-
variableFilter
private java.util.function.Predicate<net.ssehub.easy.varModel.model.AbstractVariable> variableFilter
-
assignments
private java.util.Stack<java.util.Map<java.lang.String,java.lang.Object>> assignments
-
-
Constructor Detail
-
TypeMapper
TypeMapper(net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration cfg, java.util.function.Predicate<net.ssehub.easy.varModel.model.AbstractVariable> variableFilter, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder builder)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 for#META_TYPE_NAME
-
-
Method Detail
-
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
private void mapPrimitiveType(java.lang.String name)
Maps a primitive type.- Parameters:
name- the name of the primitive type.
-
addTypeKind
private void addTypeKind(de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, IvmlTypeKind kind)Adds an AAS type kind property.- Parameters:
typeB- the type builderkind- the type kind
-
mapCompoundType
private void mapCompoundType(net.ssehub.easy.varModel.model.datatypes.Compound type)
Maps a compound type into the SMEC . May be called for duplicates but leads only to one entry.- Parameters:
type- the compound type
-
mapType
void mapType(net.ssehub.easy.varModel.model.datatypes.IDatatype type)
Maps an IVML type into the SMEC . 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
private boolean isDoneType(java.lang.String typeId)
- 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 into the SMEC . May be called for duplicates but leads only to one entry.- Parameters:
type- the derived type
-
getRefines
private static java.lang.String getRefines(net.ssehub.easy.varModel.model.datatypes.Compound type)
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, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, java.util.Set<java.lang.String> doneSlots)Maps refines of a compound type.- Parameters:
type- the typetypeB- 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, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, java.util.Set<java.lang.String> doneSlots)Maps slots of a compound type including annotation assignments.- Parameters:
cnt- the container (compound or annotation assignment)type- the containing compound typetypeB- the type builderdoneSlots- already done slot names
-
mapCompoundSlot
private void mapCompoundSlot(net.ssehub.easy.varModel.model.DecisionVariableDeclaration slot, net.ssehub.easy.varModel.model.datatypes.Compound type, de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, java.util.Set<java.lang.String> doneSlots)Map a compound slot.- Parameters:
slot- the slot to maptype- the containing compound typetypeB- the type builderdoneSlots- already done slot names
-
getAssignmentValue
private java.lang.Object getAssignmentValue(java.lang.String name)
Returns the top-most collected assignment value.- Parameters:
name- the name of the assignment variable- Returns:
- the value or null for none
-
-