intarsys runtime library

de.intarsys.tools.functor
Class DeclarationBlock

java.lang.Object
  extended by de.intarsys.tools.functor.Declaration
      extended by de.intarsys.tools.functor.DeclarationBlock
All Implemented Interfaces:
IDeclaration, IDeclarationBlock

public class DeclarationBlock
extends Declaration
implements IDeclarationBlock

A generic implementation for IDeclarationBlock.


Constructor Summary
DeclarationBlock(Object declarationContext)
           
DeclarationBlock(Object declarationContext, IDeclarationElement[] declarations)
           
 
Method Summary
 void addDeclarationElement(IDeclarationElement pDeclaration)
          Add an IDeclarationElement to this block;
 void clear()
          Remove all IDeclarationElement instances from this block;
 IDeclaration copy()
          Create a copy of this.
 IDeclarationElement getDeclarationElement(String name)
          The IDeclarationElement for the given name.
 IDeclarationElement[] getDeclarationElements()
          The array of IDeclarationElement instances in this block.
 boolean isBlock()
          true if this declaration has child elements itself.
 void moveDown(IDeclarationElement declaration)
          Move element to the position after its current position.
 void moveUp(IDeclarationElement declaration)
          Move element to the position before its current position.
 boolean removeDeclarationElement(IDeclarationElement declaration)
          Remove an IDeclarationElement from this block;
 int size()
          The number of declarations in this block.
 String toString()
           
 
Methods inherited from class de.intarsys.tools.functor.Declaration
getDeclarationContext
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.intarsys.tools.functor.IDeclaration
getDeclarationContext
 

Constructor Detail

DeclarationBlock

public DeclarationBlock(Object declarationContext)

DeclarationBlock

public DeclarationBlock(Object declarationContext,
                        IDeclarationElement[] declarations)
Method Detail

addDeclarationElement

public void addDeclarationElement(IDeclarationElement pDeclaration)
Description copied from interface: IDeclarationBlock
Add an IDeclarationElement to this block;

Specified by:
addDeclarationElement in interface IDeclarationBlock

clear

public void clear()
Description copied from interface: IDeclarationBlock
Remove all IDeclarationElement instances from this block;

Specified by:
clear in interface IDeclarationBlock

copy

public IDeclaration copy()
Description copied from interface: IDeclaration
Create a copy of this.

Specified by:
copy in interface IDeclaration
Returns:
A copy of this.

getDeclarationElement

public IDeclarationElement getDeclarationElement(String name)
Description copied from interface: IDeclarationBlock
The IDeclarationElement for the given name.

Specified by:
getDeclarationElement in interface IDeclarationBlock
Returns:
The IDeclarationElement for the given name.

getDeclarationElements

public IDeclarationElement[] getDeclarationElements()
Description copied from interface: IDeclarationBlock
The array of IDeclarationElement instances in this block.

Specified by:
getDeclarationElements in interface IDeclarationBlock
Returns:
The array of IDeclarationElement instances in this block.

isBlock

public boolean isBlock()
Description copied from interface: IDeclaration
true if this declaration has child elements itself.

A IDeclarationElement may be a IDeclarationBlock, supporting nested declarations. You should not use "instanceof IDeclarationBlock" to check this behavior but this method.

Specified by:
isBlock in interface IDeclaration
Overrides:
isBlock in class Declaration
Returns:
true if this declaration has child elements itself.

moveDown

public void moveDown(IDeclarationElement declaration)
Description copied from interface: IDeclarationBlock
Move element to the position after its current position. This means that the element declaration will be performed later.

If the element is the last declaration or not contained in the block this method does nothing.

Specified by:
moveDown in interface IDeclarationBlock

moveUp

public void moveUp(IDeclarationElement declaration)
Description copied from interface: IDeclarationBlock
Move element to the position before its current position. This means that the element declaration will be performed earlier.

If the element is the first declaration or not contained in the block this method does nothing.

Specified by:
moveUp in interface IDeclarationBlock

removeDeclarationElement

public boolean removeDeclarationElement(IDeclarationElement declaration)
Description copied from interface: IDeclarationBlock
Remove an IDeclarationElement from this block;

Specified by:
removeDeclarationElement in interface IDeclarationBlock
Returns:
true if declaration was removed

size

public int size()
Description copied from interface: IDeclarationBlock
The number of declarations in this block.

Specified by:
size in interface IDeclarationBlock
Returns:
The number of declarations in this block.

toString

public String toString()
Overrides:
toString in class Object

intarsys runtime library

Copyright © 2012 intarsys consulting GmbH. All Rights Reserved.