mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-12-22 17:51:08 +00:00
fini la doc
This commit is contained in:
parent
b5e30c4561
commit
24ddbc37c7
@ -22,9 +22,13 @@
|
||||
#define CELLELMNT_H
|
||||
|
||||
|
||||
/*---bool---
|
||||
*@true : 1
|
||||
*@false : 0
|
||||
/**
|
||||
* An essential basic type, added an ERROR for out of bounds
|
||||
*
|
||||
* @param true : 1
|
||||
* @param false : 0
|
||||
* @param ERROR : -1
|
||||
*
|
||||
*/
|
||||
typedef enum Bool{
|
||||
|
||||
@ -35,17 +39,16 @@ typedef enum Bool{
|
||||
} bool;
|
||||
|
||||
|
||||
/*---cellElement---
|
||||
*A cell of the matrix
|
||||
/**
|
||||
* A cell of the matrix
|
||||
*
|
||||
*@colIndex : index (int) of the column of this cell
|
||||
*@rowIndex : index (int) of the row of this cell
|
||||
*
|
||||
*@value : a boolean that is the content of the cell
|
||||
*
|
||||
*@nextCol : pointer on the next cellElement in the same column
|
||||
*@nextRow : pointer on the next cellElement in the same row
|
||||
* @param colIndex is index (int) of the column of this cell
|
||||
* @param rowIndex is index (int) of the row of this cell
|
||||
*
|
||||
* @param nextCol is pointer on the next cellElement in the same column
|
||||
* @param nextRow is pointer on the next cellElement in the same row
|
||||
*
|
||||
* @see CreateCellElem to allocate one and FreeCellElement to free one
|
||||
*/
|
||||
struct cellElement {
|
||||
|
||||
@ -58,140 +61,155 @@ struct cellElement {
|
||||
};
|
||||
typedef struct cellElement cellElement;
|
||||
|
||||
/*---CreateCellElem---
|
||||
*Allocates a cellElement and returns it
|
||||
/**
|
||||
* Allocates a cellElement and returns it
|
||||
*
|
||||
*@return : pointer on the allocated cellElement
|
||||
* @return pointer on the allocated cellElement
|
||||
*
|
||||
*/
|
||||
cellElement * CreateCellElem();
|
||||
|
||||
|
||||
/*---AddNextCol---
|
||||
*Allocates a cellElement and sets it as the NextCol of the tree
|
||||
/**
|
||||
* Allocates a cellElement and sets it as the NextCol of the tree
|
||||
*
|
||||
*@tree : pointer on an allocated cellElement
|
||||
* @param tree is a pointer on an allocated cellElement
|
||||
*
|
||||
*@return ; error codes
|
||||
* @return int error codes
|
||||
*
|
||||
*/
|
||||
int AddNextCol(cellElement* tree);
|
||||
|
||||
|
||||
/*---AddNextRow---
|
||||
*Allocates a cellElement and sets it as the NextRow of the tree
|
||||
/**
|
||||
* Allocates a cellElement and sets it as the NextRow of the tree
|
||||
*
|
||||
*@tree : a pointer on an allocated cellElement
|
||||
* @param tree is a pointer on an allocated cellElement
|
||||
*
|
||||
*@return : error codes
|
||||
* @return int error codes
|
||||
*
|
||||
*/
|
||||
int AddNextRow(cellElement* tree);
|
||||
|
||||
/*---removeNextCol---
|
||||
*Free the nextCol cellElement of the tree
|
||||
/**
|
||||
* Free the nextCol cellElement of the tree
|
||||
*
|
||||
*@tree : a pointer on an allocated cellElement
|
||||
* @param tree is a pointer on an allocated cellElement
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
void removeNextCol(cellElement* tree);
|
||||
|
||||
/*---removeNextRow---
|
||||
*Free the nextRow cellElement of the tree
|
||||
/**
|
||||
* Free the nextRow cellElement of the tree
|
||||
*
|
||||
*@tree : a pointer on an allocated cellElement
|
||||
* @param tree is a pointer on an allocated cellElement
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
void removeNextRow(cellElement* tree);
|
||||
|
||||
|
||||
/*---FreeCellElem---
|
||||
*Frees a cellElement and returns it
|
||||
*
|
||||
*@element : pointer on the allocated cellElement
|
||||
/**
|
||||
* Frees a cellElement and returns it
|
||||
*
|
||||
* @param element is pointer on the allocated cellElement
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
void FreeCellElement(cellElement* element);
|
||||
|
||||
|
||||
/*---is_leaf---
|
||||
*Checks is the tree is a leaf
|
||||
/**
|
||||
* Checks is the tree is a leaf
|
||||
*
|
||||
*@tree : a pointer on an allocated cellElement
|
||||
* @param tree is a pointer on an allocated cellElement
|
||||
*
|
||||
*@return : a bool
|
||||
* @return a bool (true/false)
|
||||
*
|
||||
*/
|
||||
bool is_leaf(cellElement* tree);
|
||||
|
||||
|
||||
/*---SetPositionIndex---
|
||||
*Allows you to set the colIndex and the rowIndex of the cellElement elem
|
||||
/**
|
||||
* Allows you to set the colIndex and the rowIndex of the cellElement elem
|
||||
*
|
||||
*@elem : a pointer on an allocated cellElement
|
||||
*@Col : the value for colIndex
|
||||
*@Row : the value for rowIndex
|
||||
* @param elem is a pointer on an allocated cellElement
|
||||
* @param Col is the value for colIndex
|
||||
* @param Row is the value for rowIndex
|
||||
*
|
||||
*@return : error codes
|
||||
* @return int error codes
|
||||
*
|
||||
*/
|
||||
int SetPositionIndex(cellElement* elem,int Col,int Row);
|
||||
|
||||
/*---SetNextCol---
|
||||
*Allows you to set the nextCol of the cellElement tree
|
||||
/**
|
||||
* Allows you to set the nextCol of the cellElement tree
|
||||
*
|
||||
*@tree : a pointer on the element you want to set
|
||||
*@elem : a pointer on a cellElement
|
||||
* @param tree is a pointer on the element you want to set
|
||||
* @param elem is a pointer on a cellElement
|
||||
*
|
||||
*@return : error codes
|
||||
* @return int error codes
|
||||
*
|
||||
*/
|
||||
int SetNextCol(cellElement* tree,cellElement* elem);
|
||||
|
||||
/*---SetNextRow---
|
||||
*Allows you to set the nextRow of the cellElement elem
|
||||
/**
|
||||
* Allows you to set the nextRow of the cellElement elem
|
||||
*
|
||||
*@tree : a pointer on the element you want to set
|
||||
*@elem : a pointer on a cellElement
|
||||
* @param tree is a pointer on the element you want to set
|
||||
* @param elem is a pointer on a cellElement
|
||||
*
|
||||
*@return : error codes
|
||||
* @return int error codes
|
||||
*
|
||||
*/
|
||||
int SetNextRow(cellElement* tree,cellElement* elem);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A debug function that recursively prints a tree, don't use it in not tree structured cellElements (may cause endless loops)
|
||||
*
|
||||
* @param tree a pointer on a cell element
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void recursivePrint(cellElement * tree);
|
||||
|
||||
|
||||
/**
|
||||
* Apply OR operator to a bool a and a bool b
|
||||
* Apply OR operator to a bool a and a bool b*
|
||||
*
|
||||
* @param a a bool
|
||||
* @param b a bool
|
||||
*
|
||||
* @return result a or b
|
||||
*/
|
||||
bool OR(bool a, bool b);
|
||||
|
||||
/**
|
||||
* Apply AND operator to a bool a and a bool b
|
||||
*
|
||||
* @param a a bool
|
||||
* @param b a bool
|
||||
*
|
||||
* @return result a and b
|
||||
*/
|
||||
bool AND(bool a, bool b);
|
||||
|
||||
/**
|
||||
* Apply XOR operator to a bool a and a bool b
|
||||
*
|
||||
* @param a a bool
|
||||
* @param b a bool
|
||||
*
|
||||
* @return result a and b
|
||||
*/
|
||||
bool XOR(bool a, bool b);
|
||||
|
||||
/**
|
||||
* Return false if the bool is ERROR
|
||||
*
|
||||
* @param x a bool
|
||||
*
|
||||
* @return result a bool
|
||||
*/
|
||||
bool ErrorToFalse(bool x);
|
||||
|
@ -26,6 +26,15 @@
|
||||
#define SUCCESS 0
|
||||
#define FAILURE 1
|
||||
|
||||
/**
|
||||
* One row or column of a Matrix
|
||||
*
|
||||
* @param data a pointer on the first cellElement of the column/row
|
||||
* @param next a pointer on the next col/row of the Matrix
|
||||
* @param previous a pointer on the previous col/row of the Matrix
|
||||
* @param pos the index of the col/row in the Matrix
|
||||
*
|
||||
*/
|
||||
typedef struct ListElement ListElement;
|
||||
struct ListElement {
|
||||
cellElement *data;
|
||||
@ -34,6 +43,14 @@ struct ListElement {
|
||||
int pos;
|
||||
};
|
||||
|
||||
/**
|
||||
* The list of rows or columns of a Matrix
|
||||
*
|
||||
* @param head a pointer on the first col/row of the Matrix
|
||||
* @param tail a pointer on the last col/row of the Matrix
|
||||
* @param size the number of non void cols/rows
|
||||
*
|
||||
*/
|
||||
typedef struct List {
|
||||
ListElement *head;
|
||||
ListElement *tail;
|
||||
@ -42,6 +59,7 @@ typedef struct List {
|
||||
|
||||
/**
|
||||
* Create a new list
|
||||
*
|
||||
* @return List a pointer of list
|
||||
*/
|
||||
List * CreateList();
|
||||
|
@ -292,50 +292,6 @@ void BasicPrintMatrix(Matrix matrix){
|
||||
printf("---END OF MATRIX---\n\n");
|
||||
}
|
||||
|
||||
bool RecursiveFreeCol(Matrix matrix, cellElement * elem){
|
||||
cellElement * tmp = NULL;
|
||||
ListElement * Row = NULL;
|
||||
|
||||
if (elem == NULL){
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (elem->nextRow != NULL){
|
||||
RecursiveFreeCol(matrix,elem->nextRow);
|
||||
}
|
||||
|
||||
if (elem->nextRow == NULL){
|
||||
|
||||
Row = GetElementPos(matrix.rows,elem->rowIndex);
|
||||
|
||||
if (Row == NULL || Row->data == NULL ){
|
||||
return ERROR; /*should never happend*/
|
||||
}
|
||||
|
||||
if (Row->data->colIndex == elem->colIndex){
|
||||
Row->data = NULL;
|
||||
} else {
|
||||
tmp = Row->data;
|
||||
while (tmp->nextCol != NULL && tmp->nextCol != elem){
|
||||
tmp = tmp->nextCol;
|
||||
}
|
||||
if (tmp->nextCol == NULL){
|
||||
return ERROR; /* should never happend */
|
||||
} else {
|
||||
tmp->nextCol = elem->nextCol;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FreeCellElement(elem);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; /* should never happend */
|
||||
}
|
||||
|
||||
|
||||
|
||||
Matrix freeMatrix(Matrix matrix){
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
|
@ -24,15 +24,17 @@
|
||||
#include <CellElement.h>
|
||||
#include <list.h>
|
||||
|
||||
/*---Matrix---
|
||||
*Abstract type that describe a boolean matrix
|
||||
/**
|
||||
* Abstract type that describe a boolean matrix
|
||||
*
|
||||
*@colCount : the number of columns of the matrix
|
||||
*@rowIndex : the number of rows of the matrix
|
||||
*
|
||||
*@rows : pointer on the first row that contains a true value
|
||||
*@cols : pointer on the first col that contains a true value
|
||||
* @param colCount is the number of columns of the matrix
|
||||
* @param rowIndex is the number of rows of the matrix
|
||||
*
|
||||
* @param rows is pointer on the first row that contains a true value
|
||||
* @param cols is pointer on the first col that contains a true value
|
||||
*
|
||||
* @see CreateMatrix to allocate one
|
||||
* @see freeMatrix to free one
|
||||
*/
|
||||
typedef struct Matrix {
|
||||
|
||||
@ -47,9 +49,11 @@ typedef struct Matrix {
|
||||
|
||||
/**
|
||||
* Abstract type for a matrix of booleans
|
||||
*
|
||||
* @param rows number of rows of the matrix
|
||||
* @param cols numbers of columns of the matrix
|
||||
* @param data the matrix
|
||||
*
|
||||
* @see CreateBooleanMatrix to create one
|
||||
*/
|
||||
typedef struct {
|
||||
@ -62,145 +66,159 @@ typedef struct {
|
||||
|
||||
/**
|
||||
* Function creating an empty boolean matrix
|
||||
*
|
||||
* @param cols number of cols
|
||||
* @param rows number of rows
|
||||
*
|
||||
* @return booleanmatrix a new matrix
|
||||
*/
|
||||
BooleanMatrix CreateBooleanMatrix(int cols, int rows);
|
||||
|
||||
/**
|
||||
* Randomize a BooleanMatrix
|
||||
*
|
||||
* @param matrix a BooleanMatrix
|
||||
*
|
||||
* @return booleanmatrix the processed matrix
|
||||
*/
|
||||
BooleanMatrix RandomizeBooleanMatrix(BooleanMatrix matrix);
|
||||
|
||||
/**
|
||||
* Free a BooleanMatrix
|
||||
*
|
||||
* @param matrix a BooleanMatrix
|
||||
* @return
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
void FreeBooleanMatrix(BooleanMatrix matrix);
|
||||
|
||||
/**
|
||||
* Create a Matrix from its array-based representation
|
||||
*
|
||||
* @param bmatrix BooleanMatrix
|
||||
*
|
||||
* @return m Matrix
|
||||
*/
|
||||
Matrix newMatrix(BooleanMatrix bmatrix);
|
||||
|
||||
/*---applyRules---
|
||||
*A function tha allows you to apply some rules n times on the matrix and returns it
|
||||
* A function that allows you to apply some rules n times on the matrix and returns it
|
||||
*
|
||||
*@matrix : A matrix on whitch you would apply the rules
|
||||
*
|
||||
*@Rules : Integer describing the rules
|
||||
*
|
||||
*@N : number of time the rules will be applied
|
||||
* @param matrix is a matrix on whitch you would apply the rules
|
||||
* @param Rules is an integer describing the rules
|
||||
* @param N is the number of time the rules will be applied
|
||||
*
|
||||
* @return Matrix
|
||||
*/
|
||||
Matrix applyRules(Matrix matrix,int Rules, int N);
|
||||
|
||||
/**
|
||||
*Create a void Matrix
|
||||
* Create a void Matrix
|
||||
*
|
||||
*@return a matrix
|
||||
* @return a matrix
|
||||
*
|
||||
*/
|
||||
Matrix CreateMatrix();
|
||||
|
||||
/**
|
||||
*Find and return the cell in the given matrix
|
||||
* Find and return the cell in the given matrix
|
||||
*
|
||||
*@param matrix the Matrix where we search
|
||||
*@param ColPos an int indicating the column of the cell
|
||||
*@param RowPos an int indicating the row of the cell
|
||||
* @param matrix the Matrix where we search
|
||||
* @param ColPos an int indicating the column of the cell
|
||||
* @param RowPos an int indicating the row of the cell
|
||||
*
|
||||
*@return a cellElement
|
||||
* @return a cellElement
|
||||
*
|
||||
*/
|
||||
cellElement * FindMatrixElem(Matrix matrix, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
*Create the cell in the given matrix
|
||||
* Create the cell in the given matrix
|
||||
*
|
||||
*@param matrix the Matrix
|
||||
*@param ColPos an int indicating the column of the cell
|
||||
*@param RowPos an int indicating the row of the cell
|
||||
* @param matrix the Matrix
|
||||
* @param ColPos an int indicating the column of the cell
|
||||
* @param RowPos an int indicating the row of the cell
|
||||
*
|
||||
*@return a bool (error code)
|
||||
* @return a bool (error code)
|
||||
*
|
||||
*/
|
||||
bool CreateMatrixElem(Matrix matrix, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
*Delete the cell in the given matrix
|
||||
* Delete the cell in the given matrix
|
||||
*
|
||||
*@param matrix the Matrix
|
||||
*@param ColPos an int indicating the column of the cell
|
||||
*@param RowPos an int indicating the row of the cell
|
||||
* @param matrix the Matrix
|
||||
* @param ColPos an int indicating the column of the cell
|
||||
* @param RowPos an int indicating the row of the cell
|
||||
*
|
||||
*@return an error code (int)
|
||||
* @return an error code (int)
|
||||
*
|
||||
*/
|
||||
int SupprMatrixElem(Matrix matrix, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
*Delete or create the cell in the given matrix to fit the value
|
||||
* Delete or create the cell in the given matrix to fit the value
|
||||
*
|
||||
*@param matrix the Matrix
|
||||
*@param ColPos an int indicating the column of the cell
|
||||
*@param RowPos an int indicating the row of the cell
|
||||
* @param matrix the Matrix
|
||||
* @param ColPos an int indicating the column of the cell
|
||||
* @param RowPos an int indicating the row of the cell
|
||||
*
|
||||
*@return an error code (bool)
|
||||
* @return an error code (bool)
|
||||
*
|
||||
*/
|
||||
bool SetCellValue(Matrix matrix, int ColPos, int RowPos, bool value);
|
||||
|
||||
/**
|
||||
*Checks out the value of the cell in the given matrix
|
||||
* Checks out the value of the cell in the given matrix
|
||||
*
|
||||
*@param matrix the Matrix
|
||||
*@param ColPos an int indicating the column of the cell
|
||||
*@param RowPos an int indicating the row of the cell
|
||||
* @param matrix the Matrix
|
||||
* @param ColPos an int indicating the column of the cell
|
||||
* @param RowPos an int indicating the row of the cell
|
||||
*
|
||||
*@return the value (bool)
|
||||
* @return the value (bool)
|
||||
*
|
||||
*/
|
||||
bool GetCellValue(Matrix matrix, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
*Set the number of columns and rows of the matrix and returns it
|
||||
* Set the number of columns and rows of the matrix and returns it
|
||||
*
|
||||
*@param matrix the Matrix
|
||||
*@param nbCols an int indicating the number of columns
|
||||
*@param nbRows an int indicating the number of rows
|
||||
* @param matrix the Matrix
|
||||
* @param nbCols an int indicating the number of columns
|
||||
* @param nbRows an int indicating the number of rows
|
||||
*
|
||||
*@return the matrix
|
||||
* @return the matrix
|
||||
*
|
||||
*/
|
||||
Matrix SetMatrixDim(Matrix matrix,int nbCols,int nbRows);
|
||||
|
||||
/**
|
||||
*Basically print the Matrix in the standard output
|
||||
* Basically print the Matrix in the standard output
|
||||
*
|
||||
*@param matrix the Matrix
|
||||
* @param matrix the Matrix
|
||||
*
|
||||
*@return void
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
void BasicPrintMatrix(Matrix matrix);
|
||||
|
||||
bool RecursiveFreeCol(Matrix matrix, cellElement * elem);
|
||||
|
||||
/**
|
||||
* Allows you to free a Matrix
|
||||
*
|
||||
* @param matrix is the Matrix you want to free
|
||||
*
|
||||
* @return Matrix non allocated
|
||||
*/
|
||||
Matrix freeMatrix(Matrix matrix);
|
||||
|
||||
/**
|
||||
* Given an input matrix with M rows and N columns, computes a matrix with
|
||||
* M rows and N-1 columns were each element corresponds to the operator boolean operation
|
||||
* between two successive horizontal elements in the input matrix
|
||||
*
|
||||
* @param m a Matrix
|
||||
* @param operator a function
|
||||
*
|
||||
* @return Matrix the copmuted matrix
|
||||
*/
|
||||
Matrix colSequenceOnMatrix(Matrix m, bool (operator)(bool, bool));
|
||||
@ -209,8 +227,10 @@ Matrix colSequenceOnMatrix(Matrix m, bool (operator)(bool, bool));
|
||||
* Given an input matrix with M rows and N columns, computes a matrix with
|
||||
* M-1 rows and N columns were each element corresponds to the operator boolean operation
|
||||
* between two succesive vertical elements in the input matrix
|
||||
*
|
||||
* @param m a Matrix
|
||||
* @param operator a function
|
||||
*
|
||||
* @return Matrix the copmuted matrix
|
||||
*/
|
||||
Matrix rowSequenceOnMatrix(Matrix m, bool (operator)(bool, bool));
|
||||
@ -219,7 +239,9 @@ Matrix rowSequenceOnMatrix(Matrix m, bool (operator)(bool, bool));
|
||||
* Given an input matrix with M rows and N columns, computes a matrix with
|
||||
* M rows and N-1 columns were each element corresponds to the AND boolean operation
|
||||
* between two successive horizontal elements in the input matrix
|
||||
*
|
||||
* @param m a Matrix
|
||||
*
|
||||
* @return Matrix the copmuted matrix
|
||||
*/
|
||||
Matrix andColSequenceOnMatrix(Matrix m);
|
||||
@ -228,7 +250,9 @@ Matrix andColSequenceOnMatrix(Matrix m);
|
||||
* Given an input matrix with M rows and N columns, computes a matrix with
|
||||
* M rows and N-1 columns were each element corresponds to the OR boolean operation
|
||||
* between two successive horizontal elements in the input matrix
|
||||
*
|
||||
* @param m a Matrix
|
||||
*
|
||||
* @return Matrix the copmuted matrix
|
||||
*/
|
||||
Matrix orColSequenceOnMatrix(Matrix m);
|
||||
@ -237,7 +261,9 @@ Matrix orColSequenceOnMatrix(Matrix m);
|
||||
* Given an input matrix with M rows and N columns, computes a matrix with
|
||||
* M-1 rows and N columns were each element corresponds to the AND boolean operation
|
||||
* between two succesive vertical elements in the input matrix
|
||||
*
|
||||
* @param m a Matrix
|
||||
*
|
||||
* @return Matrix the copmuted matrix
|
||||
*/
|
||||
Matrix andRowSequenceOnMatrix(Matrix m);
|
||||
@ -246,140 +272,227 @@ Matrix andRowSequenceOnMatrix(Matrix m);
|
||||
* Given an input matrix with M rows and N columns, computes a matrix with
|
||||
* M-1 rows and N columns were each element corresponds to the OR boolean operation
|
||||
* between two succesive vertical elements in the input matrix
|
||||
*
|
||||
* @param m a Matrix
|
||||
*
|
||||
* @return Matrix the copmuted matrix
|
||||
*/
|
||||
Matrix orRowSequenceOnMatrix(Matrix m);
|
||||
|
||||
/**
|
||||
* Apply a given set of rules
|
||||
*
|
||||
* @param m a matrix
|
||||
* @param n the number of rules
|
||||
* @param rules an array of rules
|
||||
*
|
||||
* @return Matrix a new modified matrix
|
||||
*/
|
||||
Matrix matrixFromRules(Matrix m, int n, int rules[]);
|
||||
|
||||
/**
|
||||
* Apply XOR to a given number of bools
|
||||
* @param n the number of bool
|
||||
*
|
||||
* @param n the number of bools
|
||||
* @param bools an array of bool
|
||||
*
|
||||
* @return bool the processed bool
|
||||
*/
|
||||
bool MXOR(int n, bool bools[]);
|
||||
|
||||
/**
|
||||
* Get a cell with first rule
|
||||
*
|
||||
* @param m a matrix
|
||||
* @param ColPos collumn pos of the current cell
|
||||
* @param RowPos row pos of the current cell
|
||||
*
|
||||
* @return bool the value of the cell got by the rule
|
||||
*/
|
||||
bool firstRule(Matrix m, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
* Get a cell with right rule
|
||||
*
|
||||
* @param m a matrix
|
||||
* @param ColPos collumn pos of the current cell
|
||||
* @param RowPos row pos of the current cell
|
||||
*
|
||||
* @return bool the value of the cell got by the rule
|
||||
*/
|
||||
bool rightRule(Matrix m, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
* Get a cell with left rule
|
||||
*
|
||||
* @param m a matrix
|
||||
* @param ColPos collumn pos of the current cell
|
||||
* @param RowPos row pos of the current cell
|
||||
*
|
||||
* @return bool the value of the cell got by the rule
|
||||
*/
|
||||
bool leftRule(Matrix m, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
* Get a cell with top rule
|
||||
*
|
||||
* @param m a matrix
|
||||
* @param ColPos collumn pos of the current cell
|
||||
* @param RowPos row pos of the current cell
|
||||
*
|
||||
* @return bool the value of the cell got by the rule
|
||||
*/
|
||||
bool topRule(Matrix m, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
* Get a cell with bottom rule
|
||||
*
|
||||
* @param m a matrix
|
||||
* @param ColPos collumn pos of the current cell
|
||||
* @param RowPos row pos of the current cell
|
||||
*
|
||||
* @return bool the value of the cell got by the rule
|
||||
*/
|
||||
bool bottomRule(Matrix m, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
* Get a cell with top_left rule
|
||||
*
|
||||
* @param m a matrix
|
||||
* @param ColPos collumn pos of the current cell
|
||||
* @param RowPos row pos of the current cell
|
||||
*
|
||||
* @return bool the value of the cell got by the rule
|
||||
*/
|
||||
bool top_leftRule(Matrix m, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
* Get a cell with top_right rule
|
||||
*
|
||||
* @param m a matrix
|
||||
* @param ColPos collumn pos of the current cell
|
||||
* @param RowPos row pos of the current cell
|
||||
*
|
||||
* @return bool the value of the cell got by the rule
|
||||
*/
|
||||
bool top_rightRule(Matrix m, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
* Get a cell with bottom_left rule
|
||||
*
|
||||
* @param m a matrix
|
||||
* @param ColPos collumn pos of the current cell
|
||||
* @param RowPos row pos of the current cell
|
||||
*
|
||||
* @return bool the value of the cell got by the rule
|
||||
*/
|
||||
bool bottom_leftRule(Matrix m, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
* Get a cell with bottom_right rule
|
||||
*
|
||||
* @param m a matrix
|
||||
* @param ColPos collumn pos of the current cell
|
||||
* @param RowPos row pos of the current cell
|
||||
*
|
||||
* @return bool the value of the cell got by the rule
|
||||
*/
|
||||
bool bottom_rightRule(Matrix m, int ColPos, int RowPos);
|
||||
|
||||
/**
|
||||
* Get a list of bool from a given set of rules
|
||||
*
|
||||
* @param m a Matrix
|
||||
* @param ColPos colon position of the point
|
||||
* @param RowPos colon position of the point
|
||||
* @param n number of rules
|
||||
* @param rules[] an array of rules
|
||||
*
|
||||
* @return bool[] an array of bool
|
||||
*/
|
||||
bool * GetFromRules(Matrix m, int ColPos, int RowPos, int n, int rules[]);
|
||||
|
||||
/*---applyRules---
|
||||
*A function tha allows you to apply some rules n times on the matrix and returns it
|
||||
/**
|
||||
* Allows you to use boolean operators between two matrices
|
||||
*
|
||||
*@matrix : A matrix on whitch you would apply the rules
|
||||
*
|
||||
*@Rules : Integer describing the rules
|
||||
*
|
||||
*@N : number of time the rules will be applied
|
||||
* @param matrix1 the first matrix you want to operate on
|
||||
* @param matrix2 the second matrix you want to operate on
|
||||
* @param operator the function operator you want to use
|
||||
*
|
||||
* @return Matrix
|
||||
*/
|
||||
Matrix applyRules(Matrix matrix,int Rules, int N);
|
||||
Matrix opMatrix(Matrix matrix1,Matrix matrix2,bool (operator)(bool, bool));
|
||||
|
||||
/**
|
||||
* Allows you to add two Matrices
|
||||
*
|
||||
* @param matrix1 the first matrix you want to add
|
||||
* @param matrix2 the second matrix you want to add
|
||||
*
|
||||
* @return Matrix the sum
|
||||
*/
|
||||
Matrix sumMatrix(Matrix matrix1,Matrix matrix2);
|
||||
|
||||
|
||||
/**
|
||||
* Allows you to multiply two Matrices (with the AND operator)
|
||||
*
|
||||
* @param matrix1 the first matrix you want to multiply
|
||||
* @param matrix2 the second matrix you want to multiply
|
||||
*
|
||||
* @return Matrix the product
|
||||
*/
|
||||
Matrix mulMatrix(Matrix matrix1,Matrix matrix2);
|
||||
|
||||
/**
|
||||
* Check out if the matrix is Empty
|
||||
*
|
||||
* @param matrix the matrix you want to check
|
||||
*
|
||||
* @return bool (true/false)
|
||||
*/
|
||||
bool isMatrixEmpty(Matrix matrix);
|
||||
|
||||
/**
|
||||
* Check out if the matrix is square
|
||||
*
|
||||
* @param matrix the matrix you want to check
|
||||
*
|
||||
* @return bool (true/false)
|
||||
*/
|
||||
bool isMatrixSquare(Matrix matrix);
|
||||
bool isColumnEmpty(Matrix matrix,int nb);
|
||||
bool isRowEmpty(Matrix matrix,int nb);
|
||||
|
||||
|
||||
/**
|
||||
* Check out if the Matrices are equals
|
||||
*
|
||||
* @param m1 Matrices
|
||||
* @param m2 Matrices
|
||||
*
|
||||
* @return bool (true/false)
|
||||
*/
|
||||
bool equalsMatrix(Matrix m1, Matrix m2);
|
||||
|
||||
|
||||
/**
|
||||
* Check out if the column is empty
|
||||
*
|
||||
* @param matrix the Matrix where the column is in
|
||||
* @param the number of the column
|
||||
*
|
||||
* @return bool (true/false)
|
||||
*/
|
||||
bool isColumnEmpty(Matrix matrix,int nb);
|
||||
|
||||
/**
|
||||
* Check out if the row is empty
|
||||
*
|
||||
* @param matrix the Matrix where the row is in
|
||||
* @param the number of the row
|
||||
*
|
||||
* @return bool (true/false)
|
||||
*/
|
||||
bool isRowEmpty(Matrix matrix,int nb);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user