diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-02 17:19:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-10-03 08:26:38 +0200 |
commit | c3b7f134b94bf2f0830b16b42bd72d235de377fb (patch) | |
tree | bf11a43bfce06ad9eb65c885a7b4470e946d9f43 /sc/inc/scmatrix.hxx | |
parent | be98dffedd70f36e7c74c4ebd6509c5868a016d1 (diff) |
loplugin:mergeclass merge ScFullMatrix into ScMatrix
ever since
commit b26f83b1cc184a79caa9e9c0ae15717ef61dde4a
Date: Fri Aug 10 21:43:32 2018 +0200
loplugin:unusedmethods
mostly this seems to be fallout from
commit 089a4f245325a5be5cd5951d85305d791b4d9cb6
Date: Mon Aug 6 14:55:04 2018 +0200
remove Calc's software interpreter
Change-Id: Id1cb89bb3d95521b7ddf7d072ee9392053e5a52b
Reviewed-on: https://gerrit.libreoffice.org/61257
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/inc/scmatrix.hxx')
-rw-r--r-- | sc/inc/scmatrix.hxx | 416 |
1 files changed, 103 insertions, 313 deletions
diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx index c7e50fe408ab..12baa8e1e7ed 100644 --- a/sc/inc/scmatrix.hxx +++ b/sc/inc/scmatrix.hxx @@ -107,19 +107,28 @@ struct ScMatrixValue } }; -/// Abstract base class for ScFullMatrix and ScVectorRefMatrix implementations. -class SC_DLLPUBLIC ScMatrix +/** + * Matrix data type that can store values of mixed types. Each element can + * be one of the following types: numeric, string, boolean, empty, and empty + * path. + */ +class SC_DLLPUBLIC ScMatrix final { + friend class ScMatrixImpl; + mutable size_t nRefCnt; // reference count mutable bool mbCloneIfConst; // Whether the matrix is cloned with a CloneIfConst() call. + std::unique_ptr<ScMatrixImpl> pImpl; ScMatrix( const ScMatrix& ) = delete; ScMatrix& operator=( const ScMatrix&) = delete; -protected: - virtual ~ScMatrix() {} - public: + ScMatrix(SCSIZE nC, SCSIZE nR); + ScMatrix(SCSIZE nC, SCSIZE nR, double fInitVal); + ScMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals ); + ~ScMatrix(); + enum Op { Add, Sub, Mul, Div }; typedef std::function<void(size_t, size_t, double)> DoubleOpFunction; @@ -193,10 +202,8 @@ public: return (nType & ScMatValType::NonvalueMask) == ScMatValType::EmptyPath; } - ScMatrix() : nRefCnt(0), mbCloneIfConst(true) {} - /** Clone the matrix. */ - virtual ScMatrix* Clone() const = 0; + ScMatrix* Clone() const; /** Clone the matrix if mbCloneIfConst (immutable) is set, otherwise return _this_ matrix, to be assigned to a ScMatrixRef. */ @@ -213,21 +220,21 @@ public: /** * Resize the matrix to specified new dimension. */ - virtual void Resize(SCSIZE nC, SCSIZE nR) = 0; + void Resize(SCSIZE nC, SCSIZE nR); - virtual void Resize(SCSIZE nC, SCSIZE nR, double fVal) = 0; + void Resize(SCSIZE nC, SCSIZE nR, double fVal); /** Clone the matrix and extend it to the new size. nNewCols and nNewRows MUST be at least of the size of the original matrix. */ - virtual ScMatrix* CloneAndExtend(SCSIZE nNewCols, SCSIZE nNewRows) const = 0; + ScMatrix* CloneAndExtend(SCSIZE nNewCols, SCSIZE nNewRows) const; void IncRef() const; void DecRef() const; - virtual void SetErrorInterpreter( ScInterpreter* p) = 0; - virtual void GetDimensions( SCSIZE& rC, SCSIZE& rR) const = 0; - virtual SCSIZE GetElementCount() const = 0; - virtual bool ValidColRow( SCSIZE nC, SCSIZE nR) const = 0; + void SetErrorInterpreter( ScInterpreter* p); + void GetDimensions( SCSIZE& rC, SCSIZE& rR) const; + SCSIZE GetElementCount() const; + bool ValidColRow( SCSIZE nC, SCSIZE nR) const; /** For a row vector or column vector, if the position does not point into the vector but is a valid column or row offset it is adapted such that @@ -235,7 +242,7 @@ public: vector, same row column 0 for a column vector. Else, for a 2D matrix, returns false. */ - virtual bool ValidColRowReplicated( SCSIZE & rC, SCSIZE & rR ) const = 0; + bool ValidColRowReplicated( SCSIZE & rC, SCSIZE & rR ) const; /** Checks if the matrix position is within the matrix. If it is not, for a row vector or column vector the position is adapted such that it points @@ -243,47 +250,47 @@ public: same row column 0 for a column vector. Else, for a 2D matrix and position not within matrix, returns false. */ - virtual bool ValidColRowOrReplicated( SCSIZE & rC, SCSIZE & rR ) const = 0; + bool ValidColRowOrReplicated( SCSIZE & rC, SCSIZE & rR ) const; - virtual void PutDouble( double fVal, SCSIZE nC, SCSIZE nR) = 0; - virtual void PutDouble( double fVal, SCSIZE nIndex) = 0; - virtual void PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) = 0; + void PutDouble( double fVal, SCSIZE nC, SCSIZE nR); + void PutDouble( double fVal, SCSIZE nIndex); + void PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR); - virtual void PutString( const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR) = 0; - virtual void PutString( const svl::SharedString& rStr, SCSIZE nIndex) = 0; - virtual void PutString( const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) = 0; + void PutString( const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR) ; + void PutString( const svl::SharedString& rStr, SCSIZE nIndex) ; + void PutString( const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) ; - virtual void PutEmpty( SCSIZE nC, SCSIZE nR) = 0; + void PutEmpty( SCSIZE nC, SCSIZE nR); /// Jump sal_False without path - virtual void PutEmptyPath( SCSIZE nC, SCSIZE nR) = 0; - virtual void PutError( FormulaError nErrorCode, SCSIZE nC, SCSIZE nR ) = 0; - virtual void PutBoolean( bool bVal, SCSIZE nC, SCSIZE nR) = 0; + void PutEmptyPath( SCSIZE nC, SCSIZE nR) ; + void PutError( FormulaError nErrorCode, SCSIZE nC, SCSIZE nR ) ; + void PutBoolean( bool bVal, SCSIZE nC, SCSIZE nR) ; - virtual void FillDouble( double fVal, - SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 ) = 0; + void FillDouble( double fVal, + SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 ) ; /** Put a column vector of doubles, starting at row nR, must fit into dimensions. */ - virtual void PutDoubleVector( const ::std::vector< double > & rVec, SCSIZE nC, SCSIZE nR ) = 0; + void PutDoubleVector( const ::std::vector< double > & rVec, SCSIZE nC, SCSIZE nR ) ; /** Put a column vector of strings, starting at row nR, must fit into dimensions. */ - virtual void PutStringVector( const ::std::vector< svl::SharedString > & rVec, SCSIZE nC, SCSIZE nR ) = 0; + void PutStringVector( const ::std::vector< svl::SharedString > & rVec, SCSIZE nC, SCSIZE nR ) ; /** Put a column vector of empties, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) = 0; + void PutEmptyVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) ; /** Put a column vector of empty results, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyResultVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) = 0; + void PutEmptyResultVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) ; /** Put a column vector of empty paths, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyPathVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) = 0; + void PutEmptyPathVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) ; /** May be used before obtaining the double value of an element to avoid passing its NAN around. @ATTENTION: MUST NOT be used if the element is a string! Use GetErrorIfNotString() instead if not sure. @returns 0 if no error, else one of err... constants */ - virtual FormulaError GetError( SCSIZE nC, SCSIZE nR) const = 0; + FormulaError GetError( SCSIZE nC, SCSIZE nR) const ; /** Use in ScInterpreter to obtain the error code, if any. @returns 0 if no error or string element, else one of err... constants */ @@ -291,91 +298,91 @@ public: { return IsValue( nC, nR) ? GetError( nC, nR) : FormulaError::NONE; } /// @return 0.0 if empty or empty path, else value or DoubleError. - virtual double GetDouble( SCSIZE nC, SCSIZE nR) const = 0; + double GetDouble( SCSIZE nC, SCSIZE nR) const ; /// @return 0.0 if empty or empty path, else value or DoubleError. - virtual double GetDouble( SCSIZE nIndex) const = 0; + double GetDouble( SCSIZE nIndex) const ; /// @return value or DoubleError or string converted to value. - virtual double GetDoubleWithStringConversion( SCSIZE nC, SCSIZE nR ) const = 0; + double GetDoubleWithStringConversion( SCSIZE nC, SCSIZE nR ) const ; /// @return empty string if empty or empty path, else string content. - virtual svl::SharedString GetString( SCSIZE nC, SCSIZE nR) const = 0; + svl::SharedString GetString( SCSIZE nC, SCSIZE nR) const ; /// @return empty string if empty or empty path, else string content. - virtual svl::SharedString GetString( SCSIZE nIndex) const = 0; + svl::SharedString GetString( SCSIZE nIndex) const ; /** @returns the matrix element's string if one is present, otherwise the numerical value formatted as string, or in case of an error the error string is returned; an empty string for empty, a "FALSE" string for empty path. */ - virtual svl::SharedString GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const = 0; + svl::SharedString GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const ; /// @ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate /// an empty string! - virtual ScMatrixValue Get( SCSIZE nC, SCSIZE nR) const = 0; + ScMatrixValue Get( SCSIZE nC, SCSIZE nR) const ; /** @return <TRUE/> if string or any empty, empty cell, empty result, empty path, in fact non-value. */ - virtual bool IsStringOrEmpty( SCSIZE nIndex ) const = 0; + bool IsStringOrEmpty( SCSIZE nIndex ) const ; /** @return <TRUE/> if string or any empty, empty cell, empty result, empty path, in fact non-value. */ - virtual bool IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if empty or empty cell or empty result, not empty path. - virtual bool IsEmpty( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsEmpty( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if empty cell, not empty or empty result or empty path. - virtual bool IsEmptyCell( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsEmptyCell( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if empty result, not empty or empty cell or empty path. - virtual bool IsEmptyResult( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsEmptyResult( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if empty path, not empty or empty cell or empty result. - virtual bool IsEmptyPath( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsEmptyPath( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if value or boolean. - virtual bool IsValue( SCSIZE nIndex ) const = 0; + bool IsValue( SCSIZE nIndex ) const ; /// @return <TRUE/> if value or boolean. - virtual bool IsValue( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsValue( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if value or boolean or empty or empty path. - virtual bool IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if boolean. - virtual bool IsBoolean( SCSIZE nC, SCSIZE nR ) const = 0; + bool IsBoolean( SCSIZE nC, SCSIZE nR ) const ; /// @return <TRUE/> if entire matrix is numeric, including booleans, with no strings or empties - virtual bool IsNumeric() const = 0; + bool IsNumeric() const ; - virtual void MatTrans( ScMatrix& mRes) const = 0; - virtual void MatCopy ( ScMatrix& mRes) const = 0; + void MatTrans( ScMatrix& mRes) const ; + void MatCopy ( ScMatrix& mRes) const ; // Convert ScInterpreter::CompareMat values (-1,0,1) to boolean values - virtual void CompareEqual() = 0; - virtual void CompareNotEqual() = 0; - virtual void CompareLess() = 0; - virtual void CompareGreater() = 0; - virtual void CompareLessEqual() = 0; - virtual void CompareGreaterEqual() = 0; - - virtual double And() const = 0; // logical AND of all matrix values, or NAN - virtual double Or() const = 0; // logical OR of all matrix values, or NAN - virtual double Xor() const = 0; // logical XOR of all matrix values, or NAN - - virtual IterateResult Sum(bool bTextAsZero) const = 0; - virtual IterateResult SumSquare(bool bTextAsZero) const = 0; - virtual IterateResult Product(bool bTextAsZero) const = 0; - virtual size_t Count(bool bCountStrings, bool bCountErrors) const = 0; - virtual size_t MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const = 0; - virtual size_t MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const = 0; - - virtual double GetMaxValue( bool bTextAsZero ) const = 0; - virtual double GetMinValue( bool bTextAsZero ) const = 0; - virtual double GetGcd() const = 0; - virtual double GetLcm() const = 0; - - virtual ScMatrixRef CompareMatrix( - sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions ) const = 0; + void CompareEqual() ; + void CompareNotEqual() ; + void CompareLess() ; + void CompareGreater() ; + void CompareLessEqual() ; + void CompareGreaterEqual() ; + + double And() const ; // logical AND of all matrix values, or NAN + double Or() const ; // logical OR of all matrix values, or NAN + double Xor() const ; // logical XOR of all matrix values, or NAN + + IterateResult Sum(bool bTextAsZero) const ; + IterateResult SumSquare(bool bTextAsZero) const ; + IterateResult Product(bool bTextAsZero) const ; + size_t Count(bool bCountStrings, bool bCountErrors) const ; + size_t MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const ; + size_t MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const ; + + double GetMaxValue( bool bTextAsZero ) const ; + double GetMinValue( bool bTextAsZero ) const ; + double GetGcd() const ; + double GetLcm() const ; + + ScMatrixRef CompareMatrix( + sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions ) const ; /** * Convert the content of matrix into a linear array of numeric values. @@ -385,247 +392,30 @@ public: * @param bEmptyAsZero if true empty elements are mapped to zero values, * otherwise they become NaN values. */ - virtual void GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero = true ) const = 0; - virtual void MergeDoubleArray( std::vector<double>& rArray, Op eOp ) const = 0; + void GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero = true ) const ; + void MergeDoubleArray( std::vector<double>& rArray, Op eOp ) const ; - virtual void NotOp(ScMatrix& rMat) = 0; - virtual void NegOp(ScMatrix& rMat) = 0; - virtual void AddOp(double fVal, ScMatrix& rMat) = 0; - virtual void SubOp(bool bFlag, double fVal, ScMatrix& rMat) = 0; - virtual void MulOp(double fVal, ScMatrix& rMat) = 0; - virtual void DivOp(bool bFlag, double fVal, ScMatrix& rMat) = 0; - virtual void PowOp(bool bFlag, double fVal, ScMatrix& rMat) = 0; + void NotOp(ScMatrix& rMat) ; + void NegOp(ScMatrix& rMat) ; + void AddOp(double fVal, ScMatrix& rMat) ; + void SubOp(bool bFlag, double fVal, ScMatrix& rMat) ; + void MulOp(double fVal, ScMatrix& rMat) ; + void DivOp(bool bFlag, double fVal, ScMatrix& rMat) ; + void PowOp(bool bFlag, double fVal, ScMatrix& rMat) ; - virtual std::vector<ScMatrix::IterateResult> Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) = 0; + std::vector<ScMatrix::IterateResult> Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) ; - virtual void ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, const std::pair<size_t, size_t>& rEndPos, + void ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, const std::pair<size_t, size_t>& rEndPos, DoubleOpFunction aDoubleFunc, BoolOpFunction aBoolFunc, StringOpFunction aStringFunc, - EmptyOpFunction aEmptyFunc) const = 0; - - virtual void MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& xMat1, const ScMatrixRef& xMat2, - SvNumberFormatter& rFormatter, svl::SharedStringPool& rPool) = 0; - -#if DEBUG_MATRIX - virtual void Dump() const = 0; -#endif -}; - -/** - * Matrix data type that can store values of mixed types. Each element can - * be one of the following types: numeric, string, boolean, empty, and empty - * path. - */ -class SC_DLLPUBLIC ScFullMatrix : public ScMatrix -{ - friend class ScMatrixImpl; - - std::unique_ptr<ScMatrixImpl> pImpl; - - ScFullMatrix( const ScFullMatrix& ) = delete; - ScFullMatrix& operator=( const ScFullMatrix&) = delete; - -public: - - ScFullMatrix(SCSIZE nC, SCSIZE nR); - ScFullMatrix(SCSIZE nC, SCSIZE nR, double fInitVal); - - ScFullMatrix( size_t nC, size_t nR, const std::vector<double>& rInitVals ); - - virtual ~ScFullMatrix() override; - - /** Clone the matrix. */ - virtual ScMatrix* Clone() const override; - - /** - * Resize the matrix to specified new dimension. - */ - virtual void Resize( SCSIZE nC, SCSIZE nR) override; - - virtual void Resize(SCSIZE nC, SCSIZE nR, double fVal) override; - - /** Clone the matrix and extend it to the new size. nNewCols and nNewRows - MUST be at least of the size of the original matrix. */ - virtual ScMatrix* CloneAndExtend(SCSIZE nNewCols, SCSIZE nNewRows) const override; - - virtual void SetErrorInterpreter( ScInterpreter* p) override; - virtual void GetDimensions( SCSIZE& rC, SCSIZE& rR) const override; - virtual SCSIZE GetElementCount() const override; - virtual bool ValidColRow( SCSIZE nC, SCSIZE nR) const override; - - /** For a row vector or column vector, if the position does not point into - the vector but is a valid column or row offset it is adapted such that - it points to an element to be replicated, same column row 0 for a row - vector, same row column 0 for a column vector. Else, for a 2D matrix, - returns false. - */ - virtual bool ValidColRowReplicated( SCSIZE & rC, SCSIZE & rR ) const override; - - /** Checks if the matrix position is within the matrix. If it is not, for a - row vector or column vector the position is adapted such that it points - to an element to be replicated, same column row 0 for a row vector, - same row column 0 for a column vector. Else, for a 2D matrix and - position not within matrix, returns false. - */ - virtual bool ValidColRowOrReplicated( SCSIZE & rC, SCSIZE & rR ) const override; - - virtual void PutDouble( double fVal, SCSIZE nC, SCSIZE nR) override; - virtual void PutDouble( double fVal, SCSIZE nIndex) override; - virtual void PutDouble(const double* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) override; - - virtual void PutString( const svl::SharedString& rStr, SCSIZE nC, SCSIZE nR) override; - virtual void PutString( const svl::SharedString& rStr, SCSIZE nIndex) override; - virtual void PutString( const svl::SharedString* pArray, size_t nLen, SCSIZE nC, SCSIZE nR) override; - - virtual void PutEmpty( SCSIZE nC, SCSIZE nR) override; - - /// Jump sal_False without path - virtual void PutEmptyPath( SCSIZE nC, SCSIZE nR) override; - virtual void PutError( FormulaError nErrorCode, SCSIZE nC, SCSIZE nR ) override; - virtual void PutBoolean( bool bVal, SCSIZE nC, SCSIZE nR) override; - - virtual void FillDouble( double fVal, - SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 ) override; - - /** Put a column vector of doubles, starting at row nR, must fit into dimensions. */ - virtual void PutDoubleVector( const ::std::vector< double > & rVec, SCSIZE nC, SCSIZE nR ) override; - - /** Put a column vector of strings, starting at row nR, must fit into dimensions. */ - virtual void PutStringVector( const ::std::vector< svl::SharedString > & rVec, SCSIZE nC, SCSIZE nR ) override; + EmptyOpFunction aEmptyFunc) const ; - /** Put a column vector of empties, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) override; - - /** Put a column vector of empty results, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyResultVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) override; - - /** Put a column vector of empty paths, starting at row nR, must fit into dimensions. */ - virtual void PutEmptyPathVector( SCSIZE nCount, SCSIZE nC, SCSIZE nR ) override; - - /** May be used before obtaining the double value of an element to avoid - passing its NAN around. - @ATTENTION: MUST NOT be used if the element is a string! - Use GetErrorIfNotString() instead if not sure. - @returns 0 if no error, else one of err... constants */ - virtual FormulaError GetError( SCSIZE nC, SCSIZE nR) const override; - - /// @return 0.0 if empty or empty path, else value or DoubleError. - virtual double GetDouble( SCSIZE nC, SCSIZE nR) const override; - /// @return 0.0 if empty or empty path, else value or DoubleError. - virtual double GetDouble( SCSIZE nIndex) const override; - /// @return value or DoubleError or string converted to value. - virtual double GetDoubleWithStringConversion( SCSIZE nC, SCSIZE nR ) const override; - - /// @return empty string if empty or empty path, else string content. - virtual svl::SharedString GetString( SCSIZE nC, SCSIZE nR) const override; - /// @return empty string if empty or empty path, else string content. - virtual svl::SharedString GetString( SCSIZE nIndex) const override; - - /** @returns the matrix element's string if one is present, otherwise the - numerical value formatted as string, or in case of an error the error - string is returned; an empty string for empty, a "FALSE" string for - empty path. */ - virtual svl::SharedString GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const override; - - /// @ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate - /// an empty string! - virtual ScMatrixValue Get( SCSIZE nC, SCSIZE nR) const override; - - /** @return <TRUE/> if string or any empty, empty cell, empty result, empty - path, in fact non-value. */ - virtual bool IsStringOrEmpty( SCSIZE nIndex ) const override; - - /** @return <TRUE/> if string or any empty, empty cell, empty result, empty - path, in fact non-value. */ - virtual bool IsStringOrEmpty( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if empty or empty cell or empty result, not empty path. - virtual bool IsEmpty( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if empty cell, not empty or empty result or empty path. - virtual bool IsEmptyCell( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if empty result, not empty or empty cell or empty path. - virtual bool IsEmptyResult( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if empty path, not empty or empty cell or empty result. - virtual bool IsEmptyPath( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if value or boolean. - virtual bool IsValue( SCSIZE nIndex ) const override; - - /// @return <TRUE/> if value or boolean. - virtual bool IsValue( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if value or boolean or empty or empty path. - virtual bool IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if boolean. - virtual bool IsBoolean( SCSIZE nC, SCSIZE nR ) const override; - - /// @return <TRUE/> if entire matrix is numeric, including booleans, with no strings or empties - virtual bool IsNumeric() const override; - - virtual void MatTrans( ScMatrix& mRes) const override; - virtual void MatCopy ( ScMatrix& mRes) const override; - - // Convert ScInterpreter::CompareMat values (-1,0,1) to boolean values - virtual void CompareEqual() override; - virtual void CompareNotEqual() override; - virtual void CompareLess() override; - virtual void CompareGreater() override; - virtual void CompareLessEqual() override; - virtual void CompareGreaterEqual() override; - - virtual double And() const override; // logical AND of all matrix values, or NAN - virtual double Or() const override; // logical OR of all matrix values, or NAN - virtual double Xor() const override; // logical XOR of all matrix values, or NAN - - virtual IterateResult Sum(bool bTextAsZero) const override; - virtual IterateResult SumSquare(bool bTextAsZero) const override; - virtual IterateResult Product(bool bTextAsZero) const override; - virtual size_t Count(bool bCountStrings, bool bCountErrors) const override; - virtual size_t MatchDoubleInColumns(double fValue, size_t nCol1, size_t nCol2) const override; - virtual size_t MatchStringInColumns(const svl::SharedString& rStr, size_t nCol1, size_t nCol2) const override; - - virtual double GetMaxValue( bool bTextAsZero ) const override; - virtual double GetMinValue( bool bTextAsZero ) const override; - virtual double GetGcd() const override; - virtual double GetLcm() const override; - - virtual ScMatrixRef CompareMatrix( - sc::Compare& rComp, size_t nMatPos, sc::CompareOptions* pOptions ) const override; - - /** - * Convert the content of matrix into a linear array of numeric values. - * String elements are mapped to NaN's and empty elements are mapped to - * either NaN or zero values. - * - * @param bEmptyAsZero if true empty elements are mapped to zero values, - * otherwise they become NaN values. - */ - virtual void GetDoubleArray( std::vector<double>& rArray, bool bEmptyAsZero = true ) const override; - virtual void MergeDoubleArray( std::vector<double>& rArray, Op eOp ) const override; - - virtual void NotOp(ScMatrix& rMat) override; - virtual void NegOp(ScMatrix& rMat) override; - virtual void AddOp(double fVal, ScMatrix& rMat) override; - virtual void SubOp(bool bFlag, double fVal, ScMatrix& rMat) override; - virtual void MulOp(double fVal, ScMatrix& rMat) override; - virtual void DivOp(bool bFlag, double fVal, ScMatrix& rMat) override; - virtual void PowOp(bool bFlag, double fVal, ScMatrix& rMat) override; - - virtual std::vector<ScMatrix::IterateResult> Collect(const std::vector<std::unique_ptr<sc::op::Op>>& aOp) override; - - virtual void ExecuteOperation(const std::pair<size_t, size_t>& rStartPos, const std::pair<size_t, size_t>& rEndPos, - DoubleOpFunction aDoubleFunc, BoolOpFunction aBoolFunc, StringOpFunction aStringFunc, - EmptyOpFunction aEmptyFunc) const override; - ScFullMatrix& operator+= ( const ScFullMatrix& r ); + void MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& xMat1, const ScMatrixRef& xMat2, + SvNumberFormatter& rFormatter, svl::SharedStringPool& rPool) ; - virtual void MatConcat(SCSIZE nMaxCol, SCSIZE nMaxRow, const ScMatrixRef& xMat1, const ScMatrixRef& xMat2, - SvNumberFormatter& rFormatter, svl::SharedStringPool& rPool) override; + ScMatrix& operator+= ( const ScMatrix& r ); #if DEBUG_MATRIX - virtual void Dump() const override; + void Dump() const; #endif }; |