Class RuleBlock
- java.lang.Object
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.ProjectElement
-
- net.ssehub.easy.instantiation.core.model.buildlangModel.RuleBlock
-
- All Implemented Interfaces:
IBuildlangElement,IRuleBlock,ILanguageElement
- Direct Known Subclasses:
AbstractRule,ForStatement,NestedRuleBlock,WhileStatement
public abstract class RuleBlock extends ProjectElement implements IRuleBlock
Defines a rule block, i.e., a set of rule elements.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private IRuleElement[]body
-
Constructor Summary
Constructors Modifier Constructor Description protectedRuleBlock(java.lang.String name, IRuleElement[] body)Creates a new rule block.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBodyElement(int index, IRuleElement elt)Changes the given rule block.static IRuleElement[]addBodyElement(IRuleElement[] body, int index, IRuleElement elt)Changes the given rule block.protected voidappend(IRuleElement elt)Appends an element to this body.IRuleElementgetBodyElement(int index)Get the element of this rule at the specified index.intgetBodyElementCount()Get the number of body elements of this rule.voidsetBody(IRuleElement[] body)Changes the body elements.protected voidsetParent(ILanguageElement parent)Changes the parent.-
Methods inherited from class net.ssehub.easy.instantiation.core.model.buildlangModel.ProjectElement
getName, getParent
-
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.buildlangModel.IRuleBlock
isVirtual, returnActualValue
-
-
-
-
Field Detail
-
body
private IRuleElement[] body
-
-
Constructor Detail
-
RuleBlock
protected RuleBlock(java.lang.String name, IRuleElement[] body)Creates a new rule block.- Parameters:
name- the name of the block (may be null if none is required)body- the body
-
-
Method Detail
-
getBodyElementCount
public int getBodyElementCount()
Description copied from interface:IRuleBlockGet the number of body elements of this rule.- Specified by:
getBodyElementCountin interfaceIRuleBlock- Returns:
- The number of body elements of this rule.
-
getBodyElement
public IRuleElement getBodyElement(int index)
Description copied from interface:IRuleBlockGet the element of this rule at the specified index.- Specified by:
getBodyElementin interfaceIRuleBlock- Parameters:
index- The 0-based index of the rule element to be returned.- Returns:
- The rule element at the given index.
-
append
protected void append(IRuleElement elt)
Appends an element to this body.- Parameters:
elt- the element to be appended
-
setBody
public void setBody(IRuleElement[] body)
Changes the body elements.- Parameters:
body- the new body elements
-
addBodyElement
public static IRuleElement[] addBodyElement(IRuleElement[] body, int index, IRuleElement elt)
Changes the given rule block. Shifts elements if necessary.- Parameters:
body- the body to modifyindex- index at which the specified element is to be insertedelt- the element to be inserted- Returns:
- the changed body
-
addBodyElement
public void addBodyElement(int index, IRuleElement elt)Description copied from interface:IRuleBlockChanges the given rule block. Shifts elements if necessary.- Specified by:
addBodyElementin interfaceIRuleBlock- Parameters:
index- index at which the specified element is to be insertedelt- the element to be inserted
-
setParent
protected void setParent(ILanguageElement parent)
Description copied from class:ProjectElementChanges the parent. Please override if children must be adjusted according. Shall be called only once per instance, but there is no limitation.- Overrides:
setParentin classProjectElement- Parameters:
parent- the parent
-
-