Package de.intarsys.tools.functor
Class DeclarationBlock
- java.lang.Object
-
- de.intarsys.tools.functor.Declaration
-
- de.intarsys.tools.functor.DeclarationBlock
-
- All Implemented Interfaces:
IDeclaration,IDeclarationBlock
public class DeclarationBlock extends Declaration implements IDeclarationBlock
A generic implementation forIDeclarationBlock.
-
-
Field Summary
Fields Modifier and Type Field Description static IDeclarationBlockEMPTY
-
Constructor Summary
Constructors Constructor Description DeclarationBlock(java.lang.Object declarationContext)DeclarationBlock(java.lang.Object declarationContext, IDeclaration[] declarations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IFunctorCallaccept(IFunctorCall call)Apply this declaration tocall.voidaddDeclaration(IDeclaration declaration)IDeclaration[]getDeclarations()The array ofIDeclarationinstances in this block.booleanisBlock()trueif this declaration has child elements itself.booleanremoveDeclaration(IDeclaration declaration)intsize()The number of declarations in this block.-
Methods inherited from class de.intarsys.tools.functor.Declaration
getDeclarationContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.intarsys.tools.functor.IDeclaration
getDeclarationContext
-
-
-
-
Field Detail
-
EMPTY
public static final IDeclarationBlock EMPTY
-
-
Constructor Detail
-
DeclarationBlock
public DeclarationBlock(java.lang.Object declarationContext)
-
DeclarationBlock
public DeclarationBlock(java.lang.Object declarationContext, IDeclaration[] declarations)
-
-
Method Detail
-
accept
public IFunctorCall accept(IFunctorCall call) throws DeclarationException
Description copied from interface:IDeclarationApply this declaration tocall.The semantics of this method is up to the designer.
- Specified by:
acceptin interfaceIDeclaration- Parameters:
call- TheIFunctorCallto be modified.- Returns:
- The modified or new
IFunctorCall. - Throws:
DeclarationException
-
addDeclaration
public void addDeclaration(IDeclaration declaration)
-
getDeclarations
public IDeclaration[] getDeclarations()
Description copied from interface:IDeclarationBlockThe array ofIDeclarationinstances in this block.- Specified by:
getDeclarationsin interfaceIDeclarationBlock- Returns:
- The array of
IDeclarationinstances in this block.
-
isBlock
public boolean isBlock()
Description copied from interface:IDeclarationtrueif this declaration has child elements itself.A
IDeclarationElementmay be aIDeclarationBlock, supporting nested declarations. You should not use "instanceof IDeclarationBlock" to check this behavior but this method.- Specified by:
isBlockin interfaceIDeclaration- Overrides:
isBlockin classDeclaration- Returns:
trueif this declaration has child elements itself.
-
removeDeclaration
public boolean removeDeclaration(IDeclaration declaration)
-
size
public int size()
Description copied from interface:IDeclarationBlockThe number of declarations in this block.- Specified by:
sizein interfaceIDeclarationBlock- Returns:
- The number of declarations in this block.
-
-