Class TypeMapper


  • class TypeMapper
    extends java.lang.Object
    Maps 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>> assignments  
      private de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder builder  
      private net.ssehub.easy.instantiation.core.model.vilTypes.configuration.Configuration cfg  
      private java.util.Set<net.ssehub.easy.varModel.model.Project> doneProjects  
      private java.util.Set<java.lang.String> doneTypes  
      private 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 void addTypeKind​(de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder typeB, IvmlTypeKind kind)
      Adds an AAS type kind property.
      private java.lang.Object getAssignmentValue​(java.lang.String name)
      Returns the top-most collected assignment value.
      private static java.lang.String getRefines​(net.ssehub.easy.varModel.model.datatypes.Compound type)
      Returns the refined type of type as comma-separated string list.
      private boolean isDoneType​(java.lang.String typeId)
      Returns whether typeId represents a done type (in doneTypes).
      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.
      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.
      private void mapCompoundType​(net.ssehub.easy.varModel.model.datatypes.Compound type)
      Maps a compound type into the SMEC .
      private void mapDerivedType​(net.ssehub.easy.varModel.model.datatypes.DerivedDatatype type)
      Maps a derived type into the SMEC .
      private void mapEnumType​(net.ssehub.easy.varModel.model.datatypes.Enum type)
      Maps an IVML enum type.
      private void mapPrimitiveType​(java.lang.String name)
      Maps a primitive type.
      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.
      (package private) void mapType​(net.ssehub.easy.varModel.model.datatypes.IDatatype type)
      Maps an IVML type into the SMEC .
      (package private) void mapTypes()
      Maps all types.
      private void mapTypes​(net.ssehub.easy.varModel.model.Project project)
      Maps all types declared in project and imported projects.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 for
        variableFilter - a variable filter to exclude certain variables/types
        builder - 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 in project and 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 builder
        kind - 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)
        Returns whether typeId represents a done type (in doneTypes). If not, adds to doneTypes.
        Parameters:
        typeId - the type id to search for
        Returns:
        true if the type is considered as done, false else
      • 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 of type as 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 type
        typeB - the type builder
        doneSlots - 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 type
        typeB - the type builder
        doneSlots - 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 map
        type - the containing compound type
        typeB - the type builder
        doneSlots - 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