Class QlUtil


  • public class QlUtil
    extends Object
    Methods for this class is used in different area of ql and ql.dcs
    • Constructor Detail

      • QlUtil

        public QlUtil()
    • Method Detail

      • isFloatNumber

        public static boolean isFloatNumber​(NumberLiteralExpression number)
        Parameters:
        number -
        Returns:
        if number is float value then true, else return false
      • cloneTypeDescription

        public static TypeDescription cloneTypeDescription​(TypeDescription source)
        Create copy of type description
        Parameters:
        source - source TypeDescription, cannot be null
        Returns:
        created copy, cannot be null
      • getTypeName

        public static String getTypeName​(TypeDescription type,
                                         boolean isRussian)
        return name of the type, language sensetive
        Parameters:
        type -
        isRussian -
        Returns:
        name of the type
      • getTypeName

        public static String getTypeName​(TypeDescriptionSource type,
                                         boolean isRussian)
        Return name of the type, language sensetive
        Parameters:
        type - the TypeDescriptionSource, may be null
        isRussian - Request russion variant of the name if true
        Returns:
        The type name. Never null
      • isNestedTable

        public static boolean isNestedTable​(DbViewElement dbView)
        Checks that dbView is nested table
        Parameters:
        dbView - checking dbView, can be null
        Returns:
        if dbView corresponding to nested table then true else false
      • isUnfixedType

        public static boolean isUnfixedType​(TypeDescription type)
        Checks qualifiers of string and binary type for 'fix'
        Parameters:
        type - checking type, cannot be null
        Returns:
        true, if string 'not fix', false otherwise
      • isUnlimitedType

        public static boolean isUnlimitedType​(TypeDescription type)
        Checks qualifiers of string and binary type for 'unlimited'
        Parameters:
        type - checking type, cannot be null
        Returns:
        true, if string 'unlimited' false otherwise
      • isUnlimitedType

        public static boolean isUnlimitedType​(TypeDescriptionSource type)
        Checks qualifiers of string and binary type for 'unlimited'
        Parameters:
        type - checking type, cannot be null
        Returns:
        true, if string 'unlimited' false otherwise
      • isCompoundType

        public static boolean isCompoundType​(TypeDescription type,
                                             org.eclipse.emf.ecore.EObject context)
        Compound type is the type which has 2 or more TypeItem.
        Parameters:
        type - cannot be null
        Returns:
        true, if it's compound
      • isCompoundType

        public static boolean isCompoundType​(TypeDescriptionSource type,
                                             org.eclipse.emf.ecore.EObject context)
        Compound type is the type which has 2 or more TypeItem.
        Parameters:
        type - cannot be null
        Returns:
        true, if it's compound
      • isSpecialCompoundType

        public static boolean isSpecialCompoundType​(TypeDescription type,
                                                    org.eclipse.emf.ecore.EObject context)
        Compound type is the type which has 2 or more TypeItem which have different base types and not is ref types. This method not expand TypeSet from TypeDescription
        Parameters:
        type - checked TypeDescription, cannot be null
        context - context object for expand TypeSet in TypeDescription, cannot be null
        Returns:
        true, if it's compound
      • isSpecialCompoundType

        public static boolean isSpecialCompoundType​(TypeDescriptionSource type,
                                                    org.eclipse.emf.ecore.EObject context)
        Compound type is the type which has 2 or more TypeItem which have different base types and not is ref types. This method not expand TypeSet from TypeDescription
        Parameters:
        type - checked TypeDescription, cannot be null
        context - context object for expand TypeSet in TypeDescription, cannot be null
        Returns:
        true, if it's compound
      • compareValueDateLiteral

        public static int compareValueDateLiteral​(DateLiteralExpression dateFt,
                                                  DateLiteralExpression dateSd)
        compare two date literals
        Parameters:
        dateFt -
        dateSd -
        Returns:
        0 - if dateFt == dateSd, 1 - if dateFt > dateSd, -1 - if dateFt < dateSd, 2 - if dateFt not comparable with dateSd
      • checkForNull

        public static int checkForNull​(Object objF,
                                       Object objS)
        Parameters:
        objF -
        objS -
        Returns:
        0 - both != null; 1 - both == null; -1 - else
      • isCurrentLangRussian

        @Deprecated
        public static boolean isCurrentLangRussian​(org.eclipse.emf.ecore.EObject eObject)
        Deprecated.
        Use the variant with provided services due to performance reasons
        Check current language of configuration for ScriptVariant.RUSSIAN
        Parameters:
        eObject - actual object
        Returns:
        true, if current language of configuration equal ScriptVariant.RUSSIAN
        See Also:
        ScriptVariant
      • isCurrentLangRussian

        public static boolean isCurrentLangRussian​(org.eclipse.emf.ecore.EObject eObject,
                                                   IResourceLookup resourceLookup,
                                                   IV8ProjectManager v8ProjectManager)
        Check current language of configuration for ScriptVariant.RUSSIAN
        Parameters:
        eObject - actual object
        resourceLookup - IResourceLookup service reference. May not be null
        v8ProjectManager - IV8ProjectManager service reference. May not be null
        Returns:
        true, if current language of configuration equal ScriptVariant.RUSSIAN
        See Also:
        ScriptVariant
      • isCurrentLangRussian

        @Deprecated
        public static boolean isCurrentLangRussian​(org.eclipse.emf.ecore.resource.Resource resource)
        Deprecated.
        Use the variant with provided services due to performance reasons
        Check current language of configuration for ScriptVariant.RUSSIAN
        Parameters:
        resource - actual resource
        Returns:
        true, if current language of configuration equal ScriptVariant.RUSSIAN
        See Also:
        ScriptVariant
      • isCurrentLangRussian

        public static boolean isCurrentLangRussian​(org.eclipse.emf.ecore.resource.Resource resource,
                                                   IResourceLookup resourceLookup,
                                                   IV8ProjectManager v8ProjectManager)
        Check current language of configuration for ScriptVariant.RUSSIAN
        Parameters:
        resource - actual resource
        resourceLookup - IResourceLookup service reference. May not be null
        v8ProjectManager - IV8ProjectManager service reference. May not be null
        Returns:
        true, if current language of configuration equal ScriptVariant.RUSSIAN
        See Also:
        ScriptVariant
      • getProposalsNameFor

        public static List<String> getProposalsNameFor​(org.eclipse.xtext.scoping.IScope scope,
                                                       boolean isTable)
        Get string proposals from scope (only that instance of Table)
        Parameters:
        scope -
        isTable - define what kind of type proposals we look up - table or field
        Returns:
        list of proposals
      • createUserDataRu

        public static Map<String,​String> createUserDataRu()
        Gets user data ru for indexing values
        Returns:
        user data ru for indexing values, never null
      • createUserDataIntnl

        public static Map<String,​String> createUserDataIntnl()
        Gets user data intnl for indexing values
        Returns:
        user data intnl for indexing values, never null
      • getExpressionOfNestedTable

        public static ACommonExpression getExpressionOfNestedTable​(CommonExpression expression,
                                                                   IDynamicDbViewFieldComputer dbViewComputer)
        Gets expression corresponding to the field of nested table
        Parameters:
        expression - checking expression, cannot be null
        dbViewComputer - actual IDynamicDbViewFieldComputer, cannot be null
        Returns:
        expression corresponding to field of nested table or null if field wasn't found
      • getRefExpressionOfNestedTable

        public static CommonExpression getRefExpressionOfNestedTable​(CommonExpression expression,
                                                                     IDynamicDbViewFieldComputer dbViewComputer)
        Gets expression corresponding to reference field of nested table
        Parameters:
        expression - checking expression, cannot be null
        dbViewComputer - actual IDynamicDbViewFieldComputer, cannot be null
        Returns:
        expression corresponding to reference field of nested table or null if reference field wasn't found
      • isPartOfBracketCommonExpression

        public static boolean isPartOfBracketCommonExpression​(CommonExpression expression)
        Checks that expression corresponding to the {@link QlPackage#Literals#BRACKET_COMMON_EXPRESSION__COMMON_EXPRESSION} part
        Parameters:
        expression - checking expression, cannot be null
        Returns:
        true if expression corresponding to the {@link QlPackage#Literals#BRACKET_COMMON_EXPRESSION__COMMON_EXPRESSION} part, false otherwise