Table of Contents

Class: Neighborhood cage.py

The abstraction of a neighbhorhood, or the set of cells that are adjacent to any given cell. Neighborhoods are not consider to be inclusive (containing the primary cell itself) since support methods support selecting between inclusive and exclusive neighborhoods. Note: Topologies and neighborhoods are used as mixins to create a map.

Methods   
__init__
countNonZero
countWith
countZero
findAllWith
findFirstWith
hasNonZero
hasWith
hasZero
inclusiveStates
inclusiveSum
neighborhood
neighbors
reduce
states
sum
  __init__ 
__init__ ( self )

Exceptions   
NotImplementedError
  countNonZero 
countNonZero ( self,  address )

Count the number of neighbors with state zero.

  countWith 
countWith (
        self,
        address,
        state,
        )

Count the number of neighbors with given state.

  countZero 
countZero ( self,  address )

Count the number of neighbors with state zero.

  findAllWith 
findAllWith (
        self,
        address,
        state,
        )

Return list of indexes of neighbors with the given state.

  findFirstWith 
findFirstWith (
        self,
        address,
        state,
        )

Finds index (into neighbor list) of first neighbor with given state, or None.

  hasNonZero 
hasNonZero ( self,  address )

Do any neighbors have nonzero state?

  hasWith 
hasWith (
        self,
        address,
        state,
        )

Do any neighbors have the given state?

  hasZero 
hasZero ( self,  address )

Do any neighbors have zero state?

  inclusiveStates 
inclusiveStates ( self,  address )

Return the list of cell values for all neighbors, including this (at the end).

  inclusiveSum 
inclusiveSum ( self,  address )

Sum the states of the neighboring cells as well as this one.

  neighborhood 
neighborhood ( self )

Return the number of neighbors in the neighborhood; this method should raise if the neighbor count varies.

Exceptions   
NotImplementedError
  neighbors 
neighbors ( self,  address )

Return a list of addresses which are neighbors. This is the main entry point for determing neighborhoods.

Exceptions   
NotImplementedError
  reduce 
reduce (
        self,
        address,
        func,
        initial=0,
        )

Do an arbitrary reduction of the states.

  states 
states ( self,  address )

Return the list of cell values for all neighbors.

  sum 
sum ( self,  address )

Sum the states of the neighboring cells.


Table of Contents

This document was automatically generated on Mon Nov 4 14:54:44 2002 by HappyDoc version 2.0.1