Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

Group Class Reference

A group on the board. More...

#include <Groups.hpp>

List of all members.

Public Member Functions

 Group ()
 Creates an empty invalid group.
std::size_t Size () const
 Number of stones in group.
HexColor Color () const
 Color of the group.
HexPoint Captain () const
 Point used as the representative of this group.
bool IsMember (HexPoint point) const
 Returns true if point is a member of group, false otherwise.
const bitset_tMembers () const
 Returns the members.
const bitset_tNbs () const
 Returns neighbours.
const bitset_tNbs (HexColorSet colorset) const
 Returns the captains of neighboring groups whose color belongs to colorset.

Private Member Functions

 Group (const Groups *groups, HexColor color, HexPoint captain, const bitset_t &members, const bitset_t &nbs)
 Used only by GroupBuilder::Build().
void ComputeColorsetNbs () const

Private Attributes

HexColor m_color
HexPoint m_captain
bitset_t m_members
bitset_t m_nbs
const Groupsm_groups
 Pointer to Groups object which this Group belongs.
std::vector< std::size_t > m_nbs_index
 Indices of neighbouring groups in parent Groups's list of groups.
bool m_colorsets_computed
 True if the colorset neighbours have been computed yet.
bitset_t m_nbs_colorset [NUM_COLOR_SETS]
 Computed colorset neighbours.

Friends

class GroupBuilder

Detailed Description

A group on the board.

A group is a maximal set of like-colored stones. Groups of color EMPTY are always singletons.

Definition at line 25 of file Groups.hpp.


Constructor & Destructor Documentation

Group::Group (  )  [inline]

Creates an empty invalid group.

Only GroupBuilder can construct valid groups.

Definition at line 89 of file Groups.hpp.

Group::Group ( const Groups groups,
HexColor  color,
HexPoint  captain,
const bitset_t members,
const bitset_t nbs 
) [inline, private]

Used only by GroupBuilder::Build().

Definition at line 97 of file Groups.hpp.


Member Function Documentation

HexPoint Group::Captain (  )  const [inline]

Point used as the representative of this group.

Definition at line 119 of file Groups.hpp.

References m_captain.

Referenced by Groups::CaptainOf(), BenzeneHtpEngine::CmdGetAbsorbGroup(), ComputeColorsetNbs(), Groups::IsCaptain(), VCBuilder::Merge(), and Groups::Nbs().

HexColor Group::Color (  )  const [inline]

Color of the group.

Definition at line 114 of file Groups.hpp.

References m_color.

Referenced by ComputeColorsetNbs(), VCBuilder::Merge(), and VCBuilder::RemoveAllContaining().

void Group::ComputeColorsetNbs (  )  const [private]
bool Group::IsMember ( HexPoint  point  )  const [inline]

Returns true if point is a member of group, false otherwise.

Definition at line 124 of file Groups.hpp.

References m_members, and benzene_bitset< _Nb >::test().

const bitset_t & Group::Members (  )  const [inline]

Returns the members.

Definition at line 129 of file Groups.hpp.

References m_members.

const bitset_t & Group::Nbs ( HexColorSet  colorset  )  const

Returns the captains of neighboring groups whose color belongs to colorset.

If first time, neighbors in each colorset will be computed.

Definition at line 116 of file Groups.cpp.

References ComputeColorsetNbs(), m_colorsets_computed, and m_nbs_colorset.

const bitset_t & Group::Nbs (  )  const [inline]

Returns neighbours.

Definition at line 134 of file Groups.hpp.

References m_nbs.

Referenced by Groups::Nbs().

std::size_t Group::Size (  )  const [inline]

Number of stones in group.

Todo:
Cache group size for speed?

Definition at line 108 of file Groups.hpp.

References benzene_bitset< _Nb >::count(), and m_members.


Friends And Related Function Documentation

friend class GroupBuilder [friend]

Definition at line 59 of file Groups.hpp.


Member Data Documentation

Definition at line 63 of file Groups.hpp.

Referenced by Captain().

Definition at line 61 of file Groups.hpp.

Referenced by Color().

bool Group::m_colorsets_computed [mutable, private]

True if the colorset neighbours have been computed yet.

Definition at line 78 of file Groups.hpp.

Referenced by Nbs().

const Groups* Group::m_groups [private]

Pointer to Groups object which this Group belongs.

Definition at line 70 of file Groups.hpp.

Referenced by ComputeColorsetNbs().

Definition at line 65 of file Groups.hpp.

Referenced by IsMember(), Members(), and Size().

Definition at line 67 of file Groups.hpp.

Referenced by GroupBuilder::Build(), and Nbs().

bitset_t Group::m_nbs_colorset[NUM_COLOR_SETS] [mutable, private]

Computed colorset neighbours.

Definition at line 81 of file Groups.hpp.

Referenced by ComputeColorsetNbs(), and Nbs().

std::vector<std::size_t> Group::m_nbs_index [private]

Indices of neighbouring groups in parent Groups's list of groups.

We don't use pointers because then it would be difficult to copy a Groups object.

Definition at line 75 of file Groups.hpp.

Referenced by GroupBuilder::Build(), and ComputeColorsetNbs().


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


6 Jan 2011 Doxygen 1.6.3