Pattern Former Concept

A Pattern Former has the job of constructing the cells in a Pattern and of determining their connectivity.


Notation


Associated Types

Name Expression Description
Pattern type PF::Pattern The type of the pattern to be formed. This type must model the Pattern concept.


Valid Expressions

The following expressions must be valid.
Name Expression Type Requirements Return Type
Pattern cell count PF::countCells(p) p must be an Argument Pack object. PF::Pattern::CellIndex
Pattern cell creation PF::makeCells(cell_iter, p) void
Pattern edge legality PF::isLegalEdge(src_cell, tgt_cell, p)
  • src_cell and tgt_cell must be of type const PF::Pattern::Cell&.
  • p must be an Argument Pack object.
bool


Expression Semantics

Name Expression Precondition Semantics Postcondition
Pattern cell count PF::countCells(p) p was used to initialize the pattern for which the number of cells to be created will be counted. Counts the number of cells to be created according to the specified named arguments. Used for memory allocation of the cell container. PF::countCells(p) >= 0
Pattern cell creation PF::makeCells(cell_iter, p)
  • cell_iter can be dereferenced, then incremented, as many as PF::countCells(p) times.
  • p was used to initialize the pattern for which the cells will be created.
Creates the cells according to the specified named arguments and inserts them in the pattern using the specified iterator.
Pattern edge legality PF::isLegalEdge(src_cell, tgt_cell, p)
  • src_cell and tgt_cell are contained in the same pattern.
  • p was used to initialize this pattern.
Returns true if this Pattern Former allows the two cells to be connected together according to the specified named arguments, false otherwise. Depending on this result, the underlying graph will or will not contain the corresponding edge.


Invariants and Runtime Complexity Guarantees

Runtime complexity is measured in turms of cell count. The following invariants must hold.
Name Invariants Runtime complexity
Pattern cell count Linear time
Pattern cell creation Linear time
Pattern edge legality Amortized constant time


Models



Multi-State Mazes in C++ is hosted by SourceForge.net. Use the Table of Contents for navigation.