Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

RingGodel Class Reference

Base Ring godel class. More...

#include <RingGodel.hpp>

Inheritance diagram for RingGodel:
PatternRingGodel

List of all members.

Classes

struct  GlobalData
struct  ValidGodelData

Public Member Functions

 RingGodel ()
 Constructor.
 RingGodel (int value)
 Initializes godel with given value: use only if you know what you are doing!
virtual ~RingGodel ()
 Destructor.
void AddColorToSlice (int slice, HexColor color)
 Adds BLACK, WHITE or EMPTY to slice in ring_godel.
void RemoveColorFromSlice (int slice, HexColor color)
 Removes a color from a slice: color can be BLACK, WHITE, EMPTY.
void SetSliceToColor (int slice, HexColor color)
 Sets the color of slice: color can be BLACK, WHITE, EMPTY.
virtual void SetEmpty ()
 Sets the godel to have all empty slices.
int Index () const
 Returns the index of this ring_godel; use to hash into arrays.
int Value () const
 Returns godel as an integer.

Static Public Member Functions

static const std::vector
< RingGodel > & 
ValidGodels ()
 Returns the valid ring godels.

Static Protected Member Functions

static int Score (HexColor color)
 Score for color in a slice.
static int AdjustScoreBySlice (int score, int slice)
 Adjusts a score by the slice.

Protected Attributes

int m_value
 The actual godel value.

Static Protected Attributes

static const int BITS_PER_SLICE = 3
 Number of bits to use for each slice in the ring godel.
static const int SLICE_MASK = 7
 Sould be 1<<(BITS_PER_SLICE) - 1.

Static Private Member Functions

static GlobalDataGetGlobalData ()
static ValidGodelDataGetValidGodelData ()

Detailed Description

Base Ring godel class.

Definition at line 16 of file RingGodel.hpp.


Constructor & Destructor Documentation

RingGodel::RingGodel (  ) 

Constructor.

Definition at line 34 of file RingGodel.cpp.

RingGodel::RingGodel ( int  value  ) 

Initializes godel with given value: use only if you know what you are doing!

Definition at line 39 of file RingGodel.cpp.

RingGodel::~RingGodel (  )  [virtual]

Destructor.

Definition at line 44 of file RingGodel.cpp.


Member Function Documentation

void RingGodel::AddColorToSlice ( int  slice,
HexColor  color 
)

Adds BLACK, WHITE or EMPTY to slice in ring_godel.

Definition at line 54 of file RingGodel.cpp.

References RingGodel::GlobalData::color_slice_score, GetGlobalData(), and m_value.

Referenced by PatternState::Update(), and PatternState::UpdateRingGodel().

int RingGodel::AdjustScoreBySlice ( int  score,
int  slice 
) [inline, static, protected]

Adjusts a score by the slice.

Definition at line 107 of file RingGodel.hpp.

References BITS_PER_SLICE.

Referenced by PatternRingGodel::AddSliceToMask(), and RingGodel::GlobalData::GlobalData().

RingGodel::GlobalData & RingGodel::GetGlobalData (  )  [static, private]
RingGodel::ValidGodelData & RingGodel::GetValidGodelData (  )  [static, private]

Definition at line 116 of file RingGodel.cpp.

Referenced by Index(), and ValidGodels().

int RingGodel::Index (  )  const

Returns the index of this ring_godel; use to hash into arrays.

Definition at line 78 of file RingGodel.cpp.

References GetValidGodelData(), RingGodel::ValidGodelData::godel_to_index, and m_value.

Referenced by HashedPatternSet::ListForGodel().

void RingGodel::RemoveColorFromSlice ( int  slice,
HexColor  color 
)

Removes a color from a slice: color can be BLACK, WHITE, EMPTY.

Definition at line 59 of file RingGodel.cpp.

References RingGodel::GlobalData::color_slice_score, GetGlobalData(), and m_value.

Referenced by PatternState::Update(), and PatternState::UpdateRingGodel().

int RingGodel::Score ( HexColor  color  )  [inline, static, protected]

Score for color in a slice.

Definition at line 112 of file RingGodel.hpp.

References BLACK, EMPTY, HexAssert, and WHITE.

Referenced by RingGodel::GlobalData::GlobalData().

void RingGodel::SetEmpty (  )  [virtual]

Sets the godel to have all empty slices.

Reimplemented in PatternRingGodel.

Definition at line 73 of file RingGodel.cpp.

References RingGodel::GlobalData::empty, GetGlobalData(), and m_value.

void RingGodel::SetSliceToColor ( int  slice,
HexColor  color 
)

Sets the color of slice: color can be BLACK, WHITE, EMPTY.

Definition at line 64 of file RingGodel.cpp.

References RingGodel::GlobalData::color_slice_score, GetGlobalData(), m_value, and RingGodel::GlobalData::mask_slice_score.

Referenced by Pattern::compute_ring_godel().

const std::vector< RingGodel > & RingGodel::ValidGodels (  )  [static]

Returns the valid ring godels.

Definition at line 122 of file RingGodel.cpp.

References GetValidGodelData(), and RingGodel::ValidGodelData::valid_godel.

Referenced by HashedPatternSet::hash().

int RingGodel::Value (  )  const [inline]

Returns godel as an integer.

Definition at line 102 of file RingGodel.hpp.

References m_value.

Referenced by PatternRingGodel::MatchesGodel().


Member Data Documentation

const int RingGodel::BITS_PER_SLICE = 3 [static, protected]

Number of bits to use for each slice in the ring godel.

Definition at line 61 of file RingGodel.hpp.

Referenced by AdjustScoreBySlice(), and RingGodel::ValidGodelData::ValidGodelData().

int RingGodel::m_value [protected]

The actual godel value.

Definition at line 58 of file RingGodel.hpp.

Referenced by AddColorToSlice(), Index(), PatternRingGodel::MatchesGodel(), RemoveColorFromSlice(), SetEmpty(), SetSliceToColor(), and Value().

const int RingGodel::SLICE_MASK = 7 [static, protected]

Sould be 1<<(BITS_PER_SLICE) - 1.

Definition at line 64 of file RingGodel.hpp.

Referenced by PatternRingGodel::AddSliceToMask(), and RingGodel::GlobalData::GlobalData().


The documentation for this class was generated from the following files:


6 Jan 2011 Doxygen 1.6.3