Class AbstractRule

    • Constructor Detail

      • AbstractRule

        protected AbstractRule​(java.lang.String name,
                               IRuleElement[] body)
        Creates the rule.
        Parameters:
        name - the name
        body - the body
    • Method Detail

      • getRuleConditionCount

        public abstract int getRuleConditionCount​(Rule.Side side)
        Get the number of match conditions on the given side of this rule.
        Parameters:
        side - the side (LHS, RHS)
        Returns:
        The number of preconditions (match conditions) of this rule.
      • getRuleCondition

        public abstract AbstractRuleMatchExpression getRuleCondition​(Rule.Side side,
                                                                     int index)
        Get the match conditions of this rule on the given side at the specified index.
        Parameters:
        side - the side (LHS, RHS)
        index - The 0-based index of the match condition to be returned.
        Returns:
        The match condition at the given index.
        Throws:
        java.lang.IndexOutOfBoundsException - if index < 0 || index >=getRuleConditionCount(Side)
      • hasCondition

        public abstract boolean hasCondition​(Rule.Side side)
        Returns whether the specified side has either rule calls or a matching condition.
        Parameters:
        side - the side (LHS, RHS)
        Returns:
        whether the specified side has cinditions at all
      • getRuleCallCount

        public abstract int getRuleCallCount​(Rule.Side side)
        Get the number of rule calls on the given side of this rule.
        Parameters:
        side - the side (LHS, RHS)
        Returns:
        The number of postconditions of this rule.
      • getRuleCall

        public abstract RuleCallExpression getRuleCall​(Rule.Side side,
                                                       int index)
        Get the rule call on the given side of this rule at the specified index.
        Parameters:
        side - the side (LHS, RHS)
        index - The 0-based index of the rule element to be returned.
        Returns:
        The rule element at the given index.
        Throws:
        java.lang.IndexOutOfBoundsException - if index < 0 || index >=getRuleCallCount(Side)
      • isProtected

        public abstract boolean isProtected()
        Returns whether a rule is declared as protected regarding its visibility.
        Returns:
        true if it is protected, false else
      • appendCallTo

        public abstract void appendCallTo​(AbstractRule target,
                                          boolean qualifiedCall)
                                   throws VilException
        Appends a call to target to the rule body. Currently, this method considers parameters only in the sequence of the parameters of this rule.
        Parameters:
        target - the rule to append the call to
        qualifiedCall - insert a qualified call if true, an unqualified call if false
        Throws:
        VilException - in case that creating / resolving the rule call fails
      • isConstructor

        public boolean isConstructor()
        Description copied from interface: IMetaOperation
        Returns whether this operation represents a constructor. Basically, for VIL a constructor is a public static method named "create" which returns an instance of the underlying type. Declared constructors are used for internal purposes.
        Specified by:
        isConstructor in interface IMetaOperation
        Returns:
        true if this operation is a "constructor", false else