Class IvmlTypeResolver

  • All Implemented Interfaces:
    ITypeResolver

    public class IvmlTypeResolver
    extends java.lang.Object
    implements ITypeResolver
    A type resolver for IVML models.
    Author:
    Holger Eichelberger
    • Constructor Detail

      • IvmlTypeResolver

        public IvmlTypeResolver​(Project project,
                                TypeRegistry typeRegistry)
        Creates an IVML type resolver.
        Parameters:
        project - the IVML model
        typeRegistry - the type registry this resolver is working for
    • Method Detail

      • cacheVariable

        private void cacheVariable​(DecisionVariableDeclaration var)
        Cache data about a variable.
        Parameters:
        var - the variable to be cached
      • resolveType

        public TypeDescriptor<?> resolveType​(java.lang.String name,
                                             boolean addIfMissing)
        Description copied from interface: ITypeResolver
        Resolves a type by its name.
        Specified by:
        resolveType in interface ITypeResolver
        Parameters:
        name - the name of the type to be resolved
        addIfMissing - whether dynamically adding (a fake) type for a missing type is allowed through this call
        Returns:
        the resolved type (or null if name cannot be resolved)
      • obtainType

        TypeDescriptor<?> obtainType​(IDatatype type)
                              throws VilException
        Obtains the VIL/VTL type for the given type. Create the type descriptor dynamically if required.
        Parameters:
        type - the type to look for
        Returns:
        the type descriptor
        Throws:
        VilException - in case that creating the type descriptor fails
      • addType

        void addType​(java.lang.String name,
                     TypeDescriptor<?> type)
        Adds a type via a given name.
        Parameters:
        name - the name of the type
        type - the type to be registered
      • resolveInstantiator

        public TypeDescriptor<? extends IVilType> resolveInstantiator​(java.lang.String name)
        Description copied from interface: ITypeResolver
        Resolves an instantiator by its name.
        Specified by:
        resolveInstantiator in interface ITypeResolver
        Parameters:
        name - the name of the type to be resolved
        Returns:
        the resolved instantiator type (or null if name cannot be resolved)
      • isKnown

        public boolean isKnown​(java.lang.String name)
        Returns whether the given type is already known.
        Parameters:
        name - the name of the type
        Returns:
        true if the type is already known, false else
      • resolveType

        public TypeDescriptor<?> resolveType​(IDatatype type)
        Description copied from interface: ITypeResolver
        Resolves a type by its IVML type.
        Specified by:
        resolveType in interface ITypeResolver
        Parameters:
        type - the type to be resolved
        Returns:
        the resolved type (or null if name cannot be resolved)