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__
average
countNonZero
countWith
countZero
findAllWith
findFirstWith
hasNonZero
hasWith
hasZero
inclusiveAverage
inclusiveStates
inclusiveSum
neighborhood
neighbors
randomState
reduce
states
sum
  __init__ 
__init__ ( self )

Exceptions   
NotImplementedError
  average 
average ( self,  address )

The average of the neighbors' states.

  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?

  inclusiveAverage 
inclusiveAverage ( self,  address )

The average of the neighbors' state, including this ones.

  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
  randomState 
randomState ( self,  address )

Return a random neighbor's state.

  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 Sat Jul 29 13:31:37 2006 by HappyDoc version 2.1