Class AbstractRule
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.ProjectElement
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.RuleBlock
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.AbstractRule
-
- All Implemented Interfaces:
IBuildlangElement,IRuleBlock,ILanguageElement,IParameterizable<VariableDeclaration>,IResolvableOperation<VariableDeclaration>,IMetaOperation,IStringValueProvider
public abstract class AbstractRule extends RuleBlock implements IResolvableOperation<VariableDeclaration>, IStringValueProvider
Defines an abstract VIL rule.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IMetaOperation
IMetaOperation.CompatibilityResult
-
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
IStringValueProvider.StringComparator
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRule(java.lang.String name, IRuleElement[] body)Creates the rule.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidappendCallTo(AbstractRule target, boolean qualifiedCall)Appends a call totargetto the rule body.abstract ScriptgetParent()Returns the parent script this rule is member of.abstract RuleCallExpressiongetRuleCall(Rule.Side side, int index)Get the rule call on the given side of this rule at the specified index.abstract intgetRuleCallCount(Rule.Side side)Get the number of rule calls on the given side of this rule.abstract AbstractRuleMatchExpressiongetRuleCondition(Rule.Side side, int index)Get the match conditions of this rule on the given side at the specified index.abstract intgetRuleConditionCount(Rule.Side side)Get the number of match conditions on the given side of this rule.abstract booleanhasCondition(Rule.Side side)Returns whether the specified side has either rule calls or a matching condition.booleanisConstructor()Returns whether this operation represents a constructor.abstract booleanisProtected()Returns whether a rule is declared as protected regarding its visibility.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.buildlangModel.RuleBlock
addBodyElement, addBodyElement, append, getBodyElement, getBodyElementCount, setBody, setParent
-
Methods inherited from class net.ssehub.easy.instantiation.core.model.buildlangModel.ProjectElement
getName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.buildlangModel.IBuildlangElement
accept
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IMetaOperation
acceptsNamedParameters, getDeclaringType, getJavaSignature, getName, getParameter, getParameterCount, getParameterType, getRequiredParameterCount, getSignature, invoke, isCompatible, isFirstParameterOperand, isPlaceholder, isStatic
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.common.IParameterizable
getParameter, getParameter, getParameterCount, getRequiredParameterCount
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.common.IResolvableOperation
getReturnType
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.buildlangModel.IRuleBlock
isVirtual, returnActualValue
-
Methods inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
getStringValue
-
-
-
-
Constructor Detail
-
AbstractRule
protected AbstractRule(java.lang.String name, IRuleElement[] body)Creates the rule.- Parameters:
name- the namebody- 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- ifindex < 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- ifindex < 0 || index >=getRuleCallCount(Side)
-
isProtected
public abstract boolean isProtected()
Returns whether a rule is declared as protected regarding its visibility.- Returns:
trueif it is protected,falseelse
-
appendCallTo
public abstract void appendCallTo(AbstractRule target, boolean qualifiedCall) throws VilException
Appends a call totargetto 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 toqualifiedCall- insert a qualified call iftrue, an unqualified call iffalse- Throws:
VilException- in case that creating / resolving the rule call fails
-
getParent
public abstract Script getParent()
Returns the parent script this rule is member of.- Specified by:
getParentin interfaceILanguageElement- Overrides:
getParentin classProjectElement- Returns:
- the parent
-
isConstructor
public boolean isConstructor()
Description copied from interface:IMetaOperationReturns 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:
isConstructorin interfaceIMetaOperation- Returns:
trueif this operation is a "constructor",falseelse
-
-