Class Rule

    • Constructor Detail

      • Rule

        public Rule​(String type,
                    String data)
        Creates a rule of a given type.
        Parameters:
        type - the name of the rule type.
        data - the text data for the rule (can be null).
      • Rule

        public Rule​(Rule original)
        Copy constructor.
        Parameters:
        original - the original object to duplicate.
    • Method Detail

      • getDisplay

        public String getDisplay()
        Gets a human readable representation of the rule.
        Returns:
        the text display of this rule.
      • setType

        public void setType​(Rule.Type type)
      • getData

        public String getData()
      • setData

        public void setData​(String data)
      • getEffectiveData

        public String getEffectiveData()
        Gets the effective text to use when applying the rule. For example if the rule is not case sensitive or need to be normalized, the original data string needs to be modified for applying the rule. The effective data is the result of those changes.
        Returns:
        the effective data for this rule.
      • getOccurs

        public int getOccurs()
      • setOccurs

        public void setOccurs​(int occurs)
      • getExistsInSource

        public boolean getExistsInSource()
        Gets the flag 'existsInSource'.
        Returns:
        the flag 'existsinSource'
      • setExistsInSource

        public void setExistsInSource​(boolean existsInSource)
        Sets the flag 'existsInSource'
        Parameters:
        existsInSource - the flag 'existsinSource' to set
      • isCaseSensitive

        public boolean isCaseSensitive()
      • setCaseSensitive

        public void setCaseSensitive​(boolean caseSensitive)
      • isEnabled

        public boolean isEnabled()
        Indicates if this rule is enabled or not.
        Returns:
        true if this rule is enabled, false if it is not.
      • setEnabled

        public void setEnabled​(boolean enabled)
        Sets the flag indicating if this rule is enabled or not.
        Parameters:
        enabled - true to enable this rule, false to disable it.
      • isInherited

        public boolean isInherited()
        Indicates if this rule is inherited from a parent object.
        Returns:
        true if this rule is inherited from a parent object, false otherwise.
      • setInherited

        public void setInherited​(boolean inherited)
        Sets the flag indicating if this rule is inherited from a parent object.
        Parameters:
        inherited - true if this rule is inherited from a parent object, false otherwise.
      • hasExtAttribute

        public boolean hasExtAttribute()
        Description copied from interface: IWithExtAttributes
        Indicates if at least one extension attribute is present.
        Specified by:
        hasExtAttribute in interface IWithExtAttributes
        Returns:
        true if at least one extension attribute is present; false otherwise.
      • getExtAttributeValue

        public String getExtAttributeValue​(String namespaceURI,
                                           String localName)
        Description copied from interface: IWithExtAttributes
        Gets the value for a given extension attribute.
        Specified by:
        getExtAttributeValue in interface IWithExtAttributes
        Parameters:
        namespaceURI - the URI of the namespace for the attribute.
        localName - the name of the attribute.
        Returns:
        the value of the extension attribute, or null if it does not exist.
      • prepare

        public void prepare()
        Creates the effective data from the data and flags for this rule. For example make the data lower-case or normalize it as needed.
      • verify

        public void verify()
        Verifies if this rule has valid parameters.
        Throws:
        XLIFFException - if there is a problem with the rule's parameters.