ilog.rules.studio.model.brl

Class IlrBRLService

  • java.lang.Object
    • org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      • org.eclipse.emf.ecore.impl.BasicEObjectImpl
        • org.eclipse.emf.ecore.impl.EObjectImpl
          • ilog.rules.studio.model.base.impl.IlrRuleProjectServiceImpl
            • ilog.rules.studio.model.brl.IlrBRLService
  • All Implemented Interfaces:
    IlrBRLParser, IlrRuleProjectService, org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.InternalEObject


    public class IlrBRLService
    extends ilog.rules.studio.model.base.impl.IlrRuleProjectServiceImpl
    implements IlrBRLParser
    This class is a Rule Project Service to handle BRL languages and BRL rules in Rule Designer. Associated to a Rule Project, it ensure management of language parsers according to vocabulary changes. It also manages compilation of BRL rules during the build process. This class provides API to parse BRL Rules in the context of a Rule Project and other utility APIs related to usage of BRL rules in Rule Designer. You can obtain the BRLService associated to a given rule project using IlrStudioBRLPlugin.getDefault().getBRLService(project).
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl

        org.eclipse.emf.ecore.impl.BasicEObjectImpl.EPropertiesHolder, org.eclipse.emf.ecore.impl.BasicEObjectImpl.EPropertiesHolderBaseImpl, org.eclipse.emf.ecore.impl.BasicEObjectImpl.EPropertiesHolderImpl
      • Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl

        org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList<E extends java.lang.Object & org.eclipse.emf.common.notify.Adapter>, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList
      • Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.InternalEObject

        org.eclipse.emf.ecore.InternalEObject.EStore
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String SERVICE_ID
      Identification of the BRL Service Rule Project service.
      • Fields inherited from class ilog.rules.studio.model.base.impl.IlrRuleProjectServiceImpl

        SERVICE_ID_EDEFAULT, serviceID
      • Fields inherited from class org.eclipse.emf.ecore.impl.EObjectImpl

        eAdapters, eContainer, eContainerFeatureID, EDELIVER, EDYNAMIC_CLASS, eFlags, ELAST_EOBJECT_FLAG, ELAST_NOTIFIER_FLAG, eProperties, EPROXY
      • Fields inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl

        EVIRTUAL_GET, EVIRTUAL_IS_SET, EVIRTUAL_NO_VALUE, EVIRTUAL_SET, EVIRTUAL_UNSET
      • Fields inherited from interface org.eclipse.emf.ecore.InternalEObject

        EOPPOSITE_FEATURE_BASE
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static java.lang.String convertToLocale(IlrBRLRule rule, java.util.Locale targetLocale)
      This method converts the definition of the given BRL rule from its original locale to the specified target locale.
      static java.lang.String getHTMLDefinition(IlrBRLRule brlRule)
      This method return an HTML representation of the given BRLRule.
      static java.util.Collection<java.lang.String> getUsedVocabularyElements(IlrModelElement elt, IlrRuleProject ruleProject)
      Returns the list of IlrVocabularyElement that are used by the given model element.
      IlrBRLVariableProvider getVariableProvider()
      This method returns the variable provider associated to this service.
      boolean hasParser(java.lang.String definitionName, java.util.Locale locale) 
      static boolean hasSyntacticErrors(java.util.Collection errs)
      this method returns true if the collection contains syntactic or lexical errors
      IlrSyntaxTree parse(IlrBRLParserInput input, IlrBRLParserConfigurationDef configuration, IlrBRLPredictionConfigurationDef predictionConfiguration)
      Retrieves a parsed representation of the input as a syntax tree.
      static IlrSyntaxTree parse(IlrBRLRule rule, java.util.Collection errors)
      This method parses a specified BRL Rule and returns the corresponding syntax tree.
      static IlrSyntaxTree parse(org.eclipse.core.resources.IProject project, java.lang.String text, java.lang.String language, java.util.Locale locale, java.util.Collection errors)
      This method parses a specified rule text written in a specified language and Locale.
      • Methods inherited from class ilog.rules.studio.model.base.impl.IlrRuleProjectServiceImpl

        basicSetRuleProject, dispose, eBasicRemoveFromContainerFeature, eGet, eInverseAdd, eInverseRemove, eIsSet, eSet, eStaticClass, eUnset, getRuleProject, getServiceID, initialize, setRuleProject, setServiceID, toString
      • Methods inherited from class org.eclipse.emf.ecore.impl.EObjectImpl

        eAdapters, eBasicAdapters, eBasicProperties, eBasicSetContainer, eClass, eContainerFeatureID, eDeliver, eInternalContainer, eInvoke, eIsProxy, eProperties, eSetClass, eSetDeliver, eSetProxyURI
      • Methods inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl

        eAddVirtualValue, eAllContents, eBaseStructuralFeatureID, eBasicRemoveFromContainer, eBasicSetContainer, eComputeVirtualValuesCapacity, eContainer, eContainerAdapterArray, eContainingFeature, eContainmentFeature, eContainmentFeature, eContains, eContents, eCrossReferences, eDerivedOperationID, eDerivedOperationID, eDerivedStructuralFeatureID, eDerivedStructuralFeatureID, eDirectResource, eDynamicBasicRemoveFromContainer, eDynamicClass, eDynamicFeature, eDynamicFeatureID, eDynamicGet, eDynamicGet, eDynamicGet, eDynamicInverseAdd, eDynamicInverseAdd, eDynamicInverseRemove, eDynamicInverseRemove, eDynamicInvoke, eDynamicInvoke, eDynamicIsSet, eDynamicIsSet, eDynamicIsSet, eDynamicSet, eDynamicSet, eDynamicSet, eDynamicUnset, eDynamicUnset, eDynamicUnset, eGet, eGet, eGet, eHasSettings, eInternalResource, eInverseAdd, eInverseRemove, eInvocationDelegate, eInvoke, eIsSet, eObjectForURIFragmentSegment, eOpenGet, eOpenIsSet, eOpenSet, eOpenUnset, eProxyURI, eRemoveVirtualValue, eResolveProxy, eResource, eSet, eSetDirectResource, eSetResource, eSetStore, eSetting, eSettingDelegate, eSettings, eSetVirtualIndexBits, eSetVirtualValue, eSetVirtualValues, eStaticFeatureCount, eStaticOperationCount, eStore, eUnset, eURIFragmentSegment, eVirtualBitCount, eVirtualGet, eVirtualGet, eVirtualIndex, eVirtualIndexBits, eVirtualIsSet, eVirtualSet, eVirtualUnset, eVirtualValue, eVirtualValues
      • Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl

        eBasicAdapterArray, eBasicHasAdapters, eNotificationRequired, eNotify
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.eclipse.emf.ecore.EObject

        eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eInvoke, eIsProxy, eIsSet, eResource, eSet, eUnset
      • Methods inherited from interface org.eclipse.emf.common.notify.Notifier

        eAdapters, eDeliver, eNotify, eSetDeliver
      • Methods inherited from interface org.eclipse.emf.ecore.InternalEObject

        eNotificationRequired
    • Field Detail

      • SERVICE_ID

        public static java.lang.String SERVICE_ID
        Identification of the BRL Service Rule Project service.
    • Method Detail

      • getVariableProvider

        public IlrBRLVariableProvider getVariableProvider()
        This method returns the variable provider associated to this service.
        Returns:
        a variable provider
      • hasParser

        public boolean hasParser(java.lang.String definitionName,
                        java.util.Locale locale)
      • parse

        public static IlrSyntaxTree parse(org.eclipse.core.resources.IProject project,
                          java.lang.String text,
                          java.lang.String language,
                          java.util.Locale locale,
                          java.util.Collection errors)
        This method parses a specified rule text written in a specified language and Locale. The rule is parsed in the context of the specified project. Parsing errors are returned in an errors collection if not null.
        Since:
        6.5
        Parameters:
        project - The project in the context of which this rule is parsed. The project determines the vocabulary and the variable provider used.
        text - The text of the rule to parse.
        language - The language definition.
        locale - The Locale.
        errors - If provided, this collection is filled with parsing errors. Parsing errors are an instance of IlrBRLMarker.
        Returns:
        The syntax tree.
      • parse

        public static IlrSyntaxTree parse(IlrBRLRule rule,
                          java.util.Collection errors)
        This method parses a specified BRL Rule and returns the corresponding syntax tree. Errors generated during parsing are collected in the specified error collection.
        Since:
        6.5
        Parameters:
        rule - The BRL rule to parse.
        errors - A collection to collect parsing errors. If null, parsing errors are not collected.
        Returns:
        A syntax tree corresponding to the specified rule or null if no parser exists for the rule.
      • getUsedVocabularyElements

        public static java.util.Collection<java.lang.String> getUsedVocabularyElements(IlrModelElement elt,
                                                                       IlrRuleProject ruleProject)
        Returns the list of IlrVocabularyElement that are used by the given model element.
        Parameters:
        elt - the model element
        ruleProject - the project to search
      • getHTMLDefinition

        public static java.lang.String getHTMLDefinition(IlrBRLRule brlRule)
        This method return an HTML representation of the given BRLRule.
        Since:
        6.6
        Parameters:
        brlRule - the rule for which we request an HTML representation
        Returns:
        a string containing the HTML representation
      • hasSyntacticErrors

        public static boolean hasSyntacticErrors(java.util.Collection errs)
        this method returns true if the collection contains syntactic or lexical errors
        Parameters:
        errs - a collection of BRLProblem
        Returns:
        true if at least one BRL lexical or syntactic error is part of the given collection
      • convertToLocale

        public static java.lang.String convertToLocale(IlrBRLRule rule,
                                       java.util.Locale targetLocale)
                                                throws java.lang.RuntimeException
        This method converts the definition of the given BRL rule from its original locale to the specified target locale. Note that the translation to the target locale is not guaranteed if the vocabulary of the target locale does not contains all required terms and phrases or if the given rule has Syntax Errors. In this last case, the translated text could not be the exact translation of the original one. In both case a Runtime Exception could be raised by this method. Note that the resulting translation could be ambiguous while interpreted in the context of the target vocabulary.
        Since:
        6.6
        Throws:
        java.lang.RuntimeException - if an error occurs reading the rule language for the target locale or when converting the rule.
        Parameters:
        rule - the BRLRule for which a translation is requested
        targetLocale - the target locale
        Returns:
        the definition of the rule in the target locale or null if the vocabulary or the language of the target locale has not been found or if the given rule has not been parsed correctly.

© Copyright IBM Corp. 1987, 2017