Class FakeSubmodel

  • All Implemented Interfaces:
    de.iip_ecosphere.platform.support.aas.DeferredParent, de.iip_ecosphere.platform.support.aas.Element, de.iip_ecosphere.platform.support.aas.ElementContainer, de.iip_ecosphere.platform.support.aas.ElementsAccess, de.iip_ecosphere.platform.support.aas.HasDataSpecification, de.iip_ecosphere.platform.support.aas.HasKind, de.iip_ecosphere.platform.support.aas.HasSemantics, de.iip_ecosphere.platform.support.aas.Identifiable, de.iip_ecosphere.platform.support.aas.Qualifiable, de.iip_ecosphere.platform.support.aas.Referable, de.iip_ecosphere.platform.support.aas.Submodel

    public class FakeSubmodel
    extends FakeElement
    implements de.iip_ecosphere.platform.support.aas.Submodel
    A fake (inefficient) submodel.
    Author:
    Holger Eichelberger, SSE
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  FakeSubmodel.FakeSubmodelBuilder
      A fake sub-model builder.
      • Nested classes/interfaces inherited from interface de.iip_ecosphere.platform.support.aas.Submodel

        de.iip_ecosphere.platform.support.aas.Submodel.SubmodelBuilder
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.Builder<?>> deferred  
      private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.aas.SubmodelElement> elements  
      private java.lang.String identifier  
      private FakeAas parent  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected FakeSubmodel​(java.lang.String idShort, java.lang.String identifier)
      Creates the instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(de.iip_ecosphere.platform.support.aas.AasVisitor visitor)  
      void buildDeferred()  
      de.iip_ecosphere.platform.support.aas.Reference createReference()  
      de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder createSubmodelElementCollectionBuilder​(java.lang.String idShort, boolean ordered, boolean allowDuplicates)  
      java.lang.Iterable<de.iip_ecosphere.platform.support.aas.DataElement> dataElements()  
      (package private) void defer​(java.lang.String shortId, de.iip_ecosphere.platform.support.Builder<?> builder)
      Registers a sub-build as deferred.
      void delete​(de.iip_ecosphere.platform.support.aas.SubmodelElement elt)  
      private <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement>
      java.util.List<T>
      filter​(java.lang.Class<T> type)
      Filters #elements() for the given type.
      private <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement>
      T
      filter​(java.lang.String idShort, java.lang.Class<T> type)
      Filters #submodelElements() for the given short id and type.
      de.iip_ecosphere.platform.support.aas.DataElement getDataElement​(java.lang.String idShort)  
      int getDataElementsCount()  
      (package private) <B extends de.iip_ecosphere.platform.support.Builder<?>>
      B
      getDeferred​(java.lang.String shortId, java.lang.Class<B> cls)
      Returns a deferred builder.
      java.lang.String getIdentification()  
      de.iip_ecosphere.platform.support.aas.Operation getOperation​(java.lang.String idShort)  
      int getOperationsCount()  
      int getPropertiesCount()  
      de.iip_ecosphere.platform.support.aas.Property getProperty​(java.lang.String idShort)  
      de.iip_ecosphere.platform.support.aas.ReferenceElement getReferenceElement​(java.lang.String idShort)  
      de.iip_ecosphere.platform.support.aas.SubmodelElement getSubmodelElement​(java.lang.String idShort)  
      de.iip_ecosphere.platform.support.aas.SubmodelElementCollection getSubmodelElementCollection​(java.lang.String idShort)  
      int getSubmodelElementsCount()  
      java.lang.Iterable<de.iip_ecosphere.platform.support.aas.Operation> operations()  
      java.lang.Iterable<de.iip_ecosphere.platform.support.aas.Property> properties()  
      java.lang.Iterable<de.iip_ecosphere.platform.support.aas.SubmodelElement> submodelElements()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface de.iip_ecosphere.platform.support.aas.Element

        getIdShort, update
    • Field Detail

      • elements

        private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.aas.SubmodelElement> elements
      • deferred

        private java.util.Map<java.lang.String,​de.iip_ecosphere.platform.support.Builder<?>> deferred
      • identifier

        private java.lang.String identifier
    • Constructor Detail

      • FakeSubmodel

        protected FakeSubmodel​(java.lang.String idShort,
                               java.lang.String identifier)
        Creates the instance.
        Parameters:
        idShort - the short id.
        identifier - the identifier of the sub-model (may be null or empty for an identification based on idShort, interpreted as an URN if this starts with urn)
    • Method Detail

      • accept

        public void accept​(de.iip_ecosphere.platform.support.aas.AasVisitor visitor)
        Specified by:
        accept in interface de.iip_ecosphere.platform.support.aas.Element
      • submodelElements

        public java.lang.Iterable<de.iip_ecosphere.platform.support.aas.SubmodelElement> submodelElements()
        Specified by:
        submodelElements in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • getSubmodelElementsCount

        public int getSubmodelElementsCount()
        Specified by:
        getSubmodelElementsCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • filter

        private <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement> java.util.List<T> filter​(java.lang.Class<T> type)
        Filters #elements() for the given type.
        Type Parameters:
        T - the element type to return
        Parameters:
        type - the element type
        Returns:
        the found element or null
      • filter

        private <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement> T filter​(java.lang.String idShort,
                                                                                           java.lang.Class<T> type)
        Filters #submodelElements() for the given short id and type.
        Type Parameters:
        T - the element type to return
        Parameters:
        idShort - the short id
        type - the element type
        Returns:
        the found element or null
      • dataElements

        public java.lang.Iterable<de.iip_ecosphere.platform.support.aas.DataElement> dataElements()
        Specified by:
        dataElements in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • properties

        public java.lang.Iterable<de.iip_ecosphere.platform.support.aas.Property> properties()
        Specified by:
        properties in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • getDataElementsCount

        public int getDataElementsCount()
        Specified by:
        getDataElementsCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • operations

        public java.lang.Iterable<de.iip_ecosphere.platform.support.aas.Operation> operations()
        Specified by:
        operations in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • getOperationsCount

        public int getOperationsCount()
        Specified by:
        getOperationsCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • getPropertiesCount

        public int getPropertiesCount()
        Specified by:
        getPropertiesCount in interface de.iip_ecosphere.platform.support.aas.ElementContainer
      • getDataElement

        public de.iip_ecosphere.platform.support.aas.DataElement getDataElement​(java.lang.String idShort)
        Specified by:
        getDataElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      • getProperty

        public de.iip_ecosphere.platform.support.aas.Property getProperty​(java.lang.String idShort)
        Specified by:
        getProperty in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      • getReferenceElement

        public de.iip_ecosphere.platform.support.aas.ReferenceElement getReferenceElement​(java.lang.String idShort)
        Specified by:
        getReferenceElement in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      • getOperation

        public de.iip_ecosphere.platform.support.aas.Operation getOperation​(java.lang.String idShort)
        Specified by:
        getOperation in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      • getSubmodelElement

        public de.iip_ecosphere.platform.support.aas.SubmodelElement getSubmodelElement​(java.lang.String idShort)
        Specified by:
        getSubmodelElement in interface de.iip_ecosphere.platform.support.aas.Submodel
      • getSubmodelElementCollection

        public de.iip_ecosphere.platform.support.aas.SubmodelElementCollection getSubmodelElementCollection​(java.lang.String idShort)
        Specified by:
        getSubmodelElementCollection in interface de.iip_ecosphere.platform.support.aas.ElementsAccess
      • createSubmodelElementCollectionBuilder

        public de.iip_ecosphere.platform.support.aas.SubmodelElementCollection.SubmodelElementCollectionBuilder createSubmodelElementCollectionBuilder​(java.lang.String idShort,
                                                                                                                                                       boolean ordered,
                                                                                                                                                       boolean allowDuplicates)
        Specified by:
        createSubmodelElementCollectionBuilder in interface de.iip_ecosphere.platform.support.aas.Submodel
      • createReference

        public de.iip_ecosphere.platform.support.aas.Reference createReference()
        Specified by:
        createReference in interface de.iip_ecosphere.platform.support.aas.Submodel
      • delete

        public void delete​(de.iip_ecosphere.platform.support.aas.SubmodelElement elt)
        Specified by:
        delete in interface de.iip_ecosphere.platform.support.aas.Submodel
      • defer

        void defer​(java.lang.String shortId,
                   de.iip_ecosphere.platform.support.Builder<?> builder)
        Registers a sub-build as deferred.
        Parameters:
        shortId - the shortId of the element
        builder - the sub-builder to be registered
        See Also:
        buildDeferred()
      • buildDeferred

        public void buildDeferred()
        Specified by:
        buildDeferred in interface de.iip_ecosphere.platform.support.aas.DeferredParent
      • getDeferred

        <B extends de.iip_ecosphere.platform.support.Builder<?>> B getDeferred​(java.lang.String shortId,
                                                                               java.lang.Class<B> cls)
        Returns a deferred builder.
        Type Parameters:
        B - the builder type
        Parameters:
        shortId - the short id
        cls - the builder type
        Returns:
        the builder or null if no builder for shortId with the respective type is registered
      • getIdentification

        public java.lang.String getIdentification()
        Specified by:
        getIdentification in interface de.iip_ecosphere.platform.support.aas.Identifiable