Class BaSyxElementTranslator

java.lang.Object
de.iip_ecosphere.platform.support.aas.basyx2.BaSyxElementTranslator

public class BaSyxElementTranslator extends Object
Bridges between arbitrary BaSyx instances and instances of the IIP-Ecosphere AAS abstraction. The BaSyx interface structure prevents handing sub-model and submodel elements collections in one type, so we define that just for the elements. We may even avoid the type checks in here, but this shall be ok for now.
Author:
Holger Eichelberger, SSE
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
    BaSyxElementTranslator.IterationSubmodelElementsRegistrar<T extends de.iip_ecosphere.platform.support.aas.SubmodelElement>
    Internal registrar applying a function to already type-matched submodel elements.
    (package private) static interface 
    Something that can take over/register submodel elements.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static boolean
    create(de.iip_ecosphere.platform.support.aas.Submodel sub, Consumer<de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder> func, boolean propagate, String... path)
    Allows to create new elements denoted by func in the nested submodel element collection in cont denoted by path.
    (package private) static List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement>
    findInPath(List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> cont, String... path)
    Finds a nested element container in path starting at cont.
    (package private) static <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement>
    boolean
    iterate(List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> cont, de.iip_ecosphere.platform.support.aas.Submodel.IteratorFunction<T> func, Class<T> cls, String... path)
    Iterates over the elements of the nested submodel element collection in cont denoted by path and applies func to each element matching the type of cls.
    (package private) static <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement>
    boolean
    matchesType(org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement elt, Class<T> cls)
    Returns whether the interface type cls matches the type of the implementing BaSyx submodel element.
    (package private) static void
    registerSubmodelElement(org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement se, BaSyxElementTranslator.SubmodelElementsRegistrar reg)
    Registers a single submodel element with reg.
    (package private) static void
    registerSubmodelElements(Collection<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> elements, BaSyxElementTranslator.SubmodelElementsRegistrar reg)
    Registers all sub-model elements, i.e., none of those handled by the other methods/interfaces.
    (package private) static void
    registerSubmodelElements(Map<String,org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> elements, BaSyxElementTranslator.SubmodelElementsRegistrar reg)
    Registers all sub-model elements, i.e., none of those handled by the other methods/interfaces.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BaSyxElementTranslator

      public BaSyxElementTranslator()
  • Method Details

    • registerSubmodelElements

      static void registerSubmodelElements(Map<String,org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> elements, BaSyxElementTranslator.SubmodelElementsRegistrar reg)
      Registers all sub-model elements, i.e., none of those handled by the other methods/interfaces.
      Parameters:
      elements - the elements to be processed (as declared by BaSyx)
      reg - the remaining registrar
    • registerSubmodelElements

      static void registerSubmodelElements(Collection<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> elements, BaSyxElementTranslator.SubmodelElementsRegistrar reg)
      Registers all sub-model elements, i.e., none of those handled by the other methods/interfaces.
      Parameters:
      elements - the elements to be processed (as declared by BaSyx)
      reg - the remaining registrar
    • registerSubmodelElement

      static void registerSubmodelElement(org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement se, BaSyxElementTranslator.SubmodelElementsRegistrar reg)
      Registers a single submodel element with reg.
      Parameters:
      se - the submodel element
      reg - the registrar to apply for registration
    • matchesType

      static <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement> boolean matchesType(org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement elt, Class<T> cls)
      Returns whether the interface type cls matches the type of the implementing BaSyx submodel element.
      Type Parameters:
      T - the interface type
      Parameters:
      elt - the element to check for a type match
      cls - the interface type
      Returns:
      true if the type matches, false
    • iterate

      static <T extends de.iip_ecosphere.platform.support.aas.SubmodelElement> boolean iterate(List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> cont, de.iip_ecosphere.platform.support.aas.Submodel.IteratorFunction<T> func, Class<T> cls, String... path)
      Iterates over the elements of the nested submodel element collection in cont denoted by path and applies func to each element matching the type of cls.
      Type Parameters:
      T - the element type
      Parameters:
      cont - the container to start at
      func - the function to apply to each matching element
      cls - the class/element type used for filtering
      path - the path to the submodel element collection starting at the elements of cont
      Returns:
      true if func was applied at least once, false if path did not point to a submodel element collection containing at least one element matching cls
    • create

      static boolean create(de.iip_ecosphere.platform.support.aas.Submodel sub, Consumer<de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder> func, boolean propagate, String... path)
      Allows to create new elements denoted by func in the nested submodel element collection in cont denoted by path.
      Parameters:
      sub - the submodel to start at
      func - the function to apply to the appointed submodel element collection
      propagate - the change into the interface instance; if applied frequently, may imply a performance issue
      path - the path to the submodel element collection starting at the elements of cont
      Returns:
      true if func was applied, false if path did not point to a submodel element collection
    • findInPath

      static List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> findInPath(List<org.eclipse.digitaltwin.aas4j.v3.model.SubmodelElement> cont, String... path)
      Finds a nested element container in path starting at cont.
      Parameters:
      cont - the container to start at
      path - the path to follow
      Returns:
      the nested container in cont specified by path, null for none