Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SolutionHolder Class Reference

This class is used to load/store solutions and retrieve them. More...

#include <solution_holder.h>

List of all members.

Static Public Methods

void load ()
void save ()
int getIndexForMap (CompressedMap const &map)
bool hasSolution (CompressedMap const &map)
bool hasSolution (int index)
int numberOfSolutions (CompressedMap const &map)
int numberOfSolutions (int index)
Movements const & movements (CompressedMap const &map, int solution)
Movements const & movements (int index, int solution)
int pushesInSolution (CompressedMap const &map, int solution)
int pushesInSolution (int index, int solution)
int linearPushesInSolution (CompressedMap const &map, int solution)
int linearPushesInSolution (int index, int solution)
int gemChangesInSolution (CompressedMap const &map, int solution)
int gemChangesInSolution (int index, int solution)
int movesInSolution (CompressedMap const &map, int solution)
int movesInSolution (int index, int solution)
QDateTime const & dateOfSolution (CompressedMap const &map, int solution)
QDateTime const & dateOfSolution (int index, int solution)
QString const & infoOfSolution (CompressedMap const &map, int solution)
QString const & infoOfSolution (int index, int solution)
int addSolution (CompressedMap const &map, Movements const &moves, int number_of_pushes, int number_of_linear_pushes, int number_of_gem_changes, int number_of_moves, QString const &info)
int addSolution (int index, Movements const &moves, int number_of_pushes, int number_of_linear_pushes, int number_of_gem_changes, int number_of_moves, QString const &info)
int addSolution (CompressedMap const &map, Movements const &moves, int number_of_pushes, int number_of_linear_pushes, int number_of_gem_changes, int number_of_moves, QString const &info, QDateTime const &date_time)
int addSolution (int index, Movements const &moves, int number_of_pushes, int number_of_linear_pushes, int number_of_gem_changes, int number_of_moves, QString const &info, QDateTime const &date_time)
void changeSolutionInfo (CompressedMap const &map, int solution, QString const &info)
void changeSolutionInfo (int index, int solution, QString const &info)
void deleteSolution (CompressedMap const &map, int solution)
void deleteSolution (int index, int solution)
bool hasLastAttempt (CompressedMap const &map)
Movements const & lastAttempt (CompressedMap const &map)
Movements const & lastAttempt (int index)
void setLastAttempt (CompressedMap const &map, Movements const &movements)
void setLastAttempt (int index, Movements const &movements)

Static Private Attributes

std::map< CompressedMap, int > s_map_indices
std::vector< std::vector<
Movements > > 
s_solutions
std::vector< Movementss_last_attempts
std::vector< std::vector<
int > > 
s_pushes
std::vector< std::vector<
int > > 
s_moves
std::vector< std::vector<
int > > 
s_linear_pushes
std::vector< std::vector<
int > > 
s_gem_changes
std::vector< std::vector<
QDateTime > > 
s_dates
std::vector< QStringList > s_infos
bool s_was_modified


Detailed Description

This class is used to load/store solutions and retrieve them.

Note that all methods are static.

If there are more solutions for a map, the first ist the best and so on.

Author:
Ralf Schmelter (ralfs@pc2a.chemie.uni-dortmund.de).
Version:
0.1


Member Function Documentation

int SolutionHolder::addSolution int index,
Movements const & moves,
int number_of_pushes,
int number_of_linear_pushes,
int number_of_gem_changes,
int number_of_moves,
QString const & info,
QDateTime const & date_time
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int SolutionHolder::addSolution CompressedMap const & map,
Movements const & moves,
int number_of_pushes,
int number_of_linear_pushes,
int number_of_gem_changes,
int number_of_moves,
QString const & info,
QDateTime const & date_time
[static]
 

Adds a new solution of a given map.

Returns the position, at which the solution was added.

Parameters:
map   The compressed map.
moves   The movements.
number_of_pushes   The number of pushes.
number_of_moves   The number of moves.
info   Additional info.
date_time   The date and time of the solution.

int SolutionHolder::addSolution int index,
Movements const & moves,
int number_of_pushes,
int number_of_linear_pushes,
int number_of_gem_changes,
int number_of_moves,
QString const & info
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int SolutionHolder::addSolution CompressedMap const & map,
Movements const & moves,
int number_of_pushes,
int number_of_linear_pushes,
int number_of_gem_changes,
int number_of_moves,
QString const & info
[static]
 

Adds a new solution of a given map.

Returns the position, at which the solution was added.

The date of the solution is the current date.

Parameters:
map   The compressed map.
moves   The movements.
number_of_pushes   The number of pushes.
number_of_moves   The number of moves.
info   Additional info.

void SolutionHolder::changeSolutionInfo int index,
int solution,
QString const & info
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void SolutionHolder::changeSolutionInfo CompressedMap const & map,
int solution,
QString const & info
[static]
 

Changes the info of a given solution.

Parameters:
map   The compressed map.
solution   The index of the solution.
info   Additional info.

QDateTime const& SolutionHolder::dateOfSolution int index,
int solution
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

QDateTime const& SolutionHolder::dateOfSolution CompressedMap const & map,
int solution
[static]
 

Returns the date, when the solution was made.

Parameters:
map   The compressed map.
solution   The index of the solution.

void SolutionHolder::deleteSolution int index,
int solution
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void SolutionHolder::deleteSolution CompressedMap const & map,
int solution
[static]
 

Deletes a given solution of a map.

Parameters:
map   The compressed map.
solution   The index of the solution.

int SolutionHolder::gemChangesInSolution int index,
int solution
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int SolutionHolder::gemChangesInSolution CompressedMap const & map,
int solution
[static]
 

Returns the number of gem changes in the solution.

Parameters:
map   The compressed map.
solution   The index of the solution.

int SolutionHolder::getIndexForMap CompressedMap const & map [static]
 

Returns an index for a given map.

If there is not info for the map, -1 will be returned.

If you have the index, the lookups will be much faster.

bool SolutionHolder::hasLastAttempt CompressedMap const & map [static]
 

Returns true, if a last attempt for the given map exists.

Parameters:
map   The compressed map.

bool SolutionHolder::hasSolution int index [static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

bool SolutionHolder::hasSolution CompressedMap const & map [static]
 

Returns true, if a solution for the given map exists.

Parameters:
map   The compressed map to test.

QString const& SolutionHolder::infoOfSolution int index,
int solution
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

QString const& SolutionHolder::infoOfSolution CompressedMap const & map,
int solution
[static]
 

Returns additional info for a solution.

Parameters:
map   The compressed map.
solution   The index of the solution.

Movements const& SolutionHolder::lastAttempt int index [static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Movements const& SolutionHolder::lastAttempt CompressedMap const & map [static]
 

Returns the movements of the last attempt.

Parameters:
map   The compressed map.

int SolutionHolder::linearPushesInSolution int index,
int solution
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int SolutionHolder::linearPushesInSolution CompressedMap const & map,
int solution
[static]
 

Returns the number of linear pushes in the solution.

Parameters:
map   The compressed map.
solution   The index of the solution.

void SolutionHolder::load [static]
 

Reads in all previos stored levels.

Movements const& SolutionHolder::movements int index,
int solution
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Movements const& SolutionHolder::movements CompressedMap const & map,
int solution
[static]
 

Returns the movements for a given solutions of a map.

Parameters:
map   The compressed map.
solution   The index of the solution.

int SolutionHolder::movesInSolution int index,
int solution
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int SolutionHolder::movesInSolution CompressedMap const & map,
int solution
[static]
 

Returns the number of moves in the solution.

Parameters:
map   The compressed map.
solution   The index of the solution.

int SolutionHolder::numberOfSolutions int index [static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int SolutionHolder::numberOfSolutions CompressedMap const & map [static]
 

Returns the number of solutions of a give map.

Parameters:
map   The compressed map to test.

int SolutionHolder::pushesInSolution int index,
int solution
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

int SolutionHolder::pushesInSolution CompressedMap const & map,
int solution
[static]
 

Returns the number of pushes in the solution.

Parameters:
map   The compressed map.
solution   The index of the solution.

void SolutionHolder::save [static]
 

Stores all modifications.

void SolutionHolder::setLastAttempt int index,
Movements const & movements
[static]
 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void SolutionHolder::setLastAttempt CompressedMap const & map,
Movements const & movements
[static]
 

Sets a new last attempt of a given map.

Parameters:
map   The compressed map.
movements   The movements.


Member Data Documentation

std::vector<std::vector<QDateTime> > SolutionHolder::s_dates [static, private]
 

Here we store the date.

std::vector<std::vector<int> > SolutionHolder::s_gem_changes [static, private]
 

Here we store the number of gem changes in the solution.

std::vector<QStringList > SolutionHolder::s_infos [static, private]
 

Here we store the info.

std::vector<Movements> SolutionHolder::s_last_attempts [static, private]
 

Here we store the last attempts.

std::vector<std::vector<int> > SolutionHolder::s_linear_pushes [static, private]
 

Here we store the number of linear pushes in the solution.

std::map<CompressedMap, int> SolutionHolder::s_map_indices [static, private]
 

Here we store the id strings of all maps and their associated number.

std::vector<std::vector<int> > SolutionHolder::s_moves [static, private]
 

Here we store the number of moves in the solution.

std::vector<std::vector<int> > SolutionHolder::s_pushes [static, private]
 

Here we store the number of pushes in the solution.

std::vector<std::vector<Movements> > SolutionHolder::s_solutions [static, private]
 

Here we store the the solution movements.

bool SolutionHolder::s_was_modified [static, private]
 

If true, the solution was modified.


The documentation for this class was generated from the following file:
Generated at Sun Jan 6 18:49:12 2002 for EasySok by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001