net.sourceforge.barbecue
Class CompositeModule

java.lang.Object
  extended bynet.sourceforge.barbecue.Module
      extended bynet.sourceforge.barbecue.CompositeModule

public class CompositeModule
extends Module

Specific implementation of Module that allows the grouping of multiple Modules into one parent module.

Note: You should not instantiate this class directly.

Author:
Ian Bourke

Field Summary
 
Fields inherited from class net.sourceforge.barbecue.Module
bars
 
Constructor Summary
CompositeModule()
          Constructs a new Composite module that is initially empty.
 
Method Summary
 void add(Module module)
          Adds the given module to this composite module.
protected  double draw(AbstractOutput output, double x, double y)
          Draws the module to the given outputter at the specified origin.
 Module getModule(int index)
          Returns the child module at the specified index.
 java.lang.String getSymbol()
          Returns the symbol group encoded by this module.
 int size()
          Returns the number of modules currently contained within this composite module.
 
Methods inherited from class net.sourceforge.barbecue.Module
equals, hashCode, setSymbol, toString, widthInBars
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompositeModule

public CompositeModule()
Constructs a new Composite module that is initially empty.

Method Detail

add

public void add(Module module)
Adds the given module to this composite module.

Parameters:
module - The module to add

size

public int size()
Returns the number of modules currently contained within this composite module.

Returns:
The number of child modules

getModule

public Module getModule(int index)
Returns the child module at the specified index.

Parameters:
index - The module index
Returns:
The module at the given index

getSymbol

public java.lang.String getSymbol()
Returns the symbol group encoded by this module. This is actually a concatenation of the symbols encoded by each child module.

Overrides:
getSymbol in class Module
Returns:
The symbol encoded by this composite module

draw

protected double draw(AbstractOutput output,
                      double x,
                      double y)
Draws the module to the given outputter at the specified origin. This actually draws each child module in turn.

Overrides:
draw in class Module
Parameters:
output - The outputter to draw to
x - The X component of the origin
y - The Y component of the origin
Returns:
The total width drawn