MatrixBerryCore
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
mxberry::core::struct::StructDisp Class Reference

This class is responsible for displaying structure outline. More...

Inheritance diagram for mxberry::core::struct::StructDisp:
Inheritance graph
[legend]
Collaboration diagram for mxberry::core::struct::StructDisp:
Collaboration graph
[legend]

Public Member Functions

function StructDisp (in varargin)
 STRUCTDISP is a constructor for the class of the same name. More...
 
function char (in self)
 toString returns string with displayed outline of structure or simply displays this outline (in the case there are no output arguments) More...
 
function disp (in self)
 
function update (in self, in SStructInp)
 UPDATE quickly updates stored displayed outline by comparison of old and new values of structure, besides, some additional information concerning numbers of rows that were changed and for each of these row the corresponding number of column starting from which the change in this row was made. More...
 

Static Public Member Functions

static function strucdisp (in varargin)
 STRUCDISP display structure outline. More...
 

Private Member Functions

function initialize (in self, in SStructInp)
 
function getRecFieldPrintAddArgs (in self)
 

Static Private Member Functions

static function parseArgList (in argCVec)
 
static function getConstant (in constantName)
 
static function recFieldPrint (in Structure, in indent, in printValues, in structureName, in maxArrayLength, in depth, in numberFormat, in DASH_SYMBOL_CODE, in FILLER_SYMBOL_CODE)
 
static function getFieldName (in fieldNameList, in iElem)
 
static function formCellOfString (in strIndent, in fieldValue, in maxFieldLength, in filler, in FILLER_SYMBOL_CODE, in DASH_SYMBOL_CODE)
 
static function getIndentation (in indent)
 x = ' | '; str = ''; More...
 
static function createArraySize (in varName, in type)
 
static function getleaveslist (in SInp, in SOld, in isFullCheck)
 GETLEAVESLIST generates a list of structure leaves paths. More...
 
static function getleaveslistint (in SInp, in SOld, in fieldNameList)
 

Private Attributes

Constant Property FILLER_SYMBOL_CODE =32
 
Constant Property DASH_SYMBOL_CODE =45
 
Constant Property DEFAULT_MAX_ARRAY_LENGTH =10
 
Constant Property DEFAULT_DEPTH =-1
 
Constant Property DEFAULT_PRINT_VALUES =true
 
Constant Property DEFAULT_NUMBER_FORMAT ='
 
Constant Property DEFAULT_NAME = 'Structure'
 
Property SStruct
 
Property dispCVec
 
Property SLeavesInfoVec
 
Property depth
 
Property inpPrintValues
 
Property maxArrayLength
 
Property numberFormat
 
Property structureName
 
Property isFullCheck
 

Detailed Description

This class is responsible for displaying structure outline.

Definition at line 4 of file StructDisp.m.

Constructor & Destructor Documentation

◆ StructDisp()

function mxberry::core::struct::StructDisp::StructDisp ( in  varargin)

STRUCTDISP is a constructor for the class of the same name.

*  Usage: StructDisp(SInp,varargin)
* 
*  Input:
*    regular:
*        SInp: struct[1,1] - is a scalar structure datatype with
*            unknown field content
*    properties:
*        depth: numeric[1,1] - the number of hierarchical levels
*            of the structure that are displayed; if depth is
*            smaller than zero, all levels are displayed;
*            default value is -1 (display all levels)
*        printValues: logical[1,1] -  flag that states if the
*            field values should be displayed as well; the
*            default value is true (print values)
*        maxArrayLength: numberic[1,1] - a positive integer
*            which determines up to which length or size the
*            values of a vector or matrix are printed; for a
*            vector holds that if the length of the vector is
*            smaller or equal to maxArrayLength, the values are
*            printed; if the vector is longer than
*            maxArrayLength, then only the size of the vector is
*            printed; the values of a 2-dimensional (m,n) array
*            are printed if the number of elements (m x n) is
*            smaller or equal to maxArrayLength; for vectors and
*            arrays, this constraint overrides the printValues
*            flag
*        numberFormat: char[1,] - format specification used for
*            displaying numeric values, passed directly to
*            sprintf, by default '%g' is used
*        defaultName: char [1,] - default name of the structure
*            itself
*        isFullCheck: logical [1,1] - if false, then it is
*            supposed that only the values of leaves for SInp
*            may be changed when UPDATE method is called, so
*            that the inner structure is stable and no
*            additional checks should be performed; otherwise
*            the full check for consistency of inner structure
*            of old and new values of SInp is performed
* 
Author
Peter Gagarinov, PhD pgaga.nosp@m.rino.nosp@m.v@gma.nosp@m.il.c.nosp@m.om
Ilya Roublev, PhD iroub.nosp@m.lev@.nosp@m.gmail.nosp@m..com

Member Function Documentation

◆ char()

function mxberry::core::struct::StructDisp::char ( in  self)

toString returns string with displayed outline of structure or simply displays this outline (in the case there are no output arguments)

*  Usage: resStr=char(self) OR self.char()
* 
*  Input:
*    regular:
*      self: StructDisp [1,1] - class object
*  Output:
*    resStr: char [1,] - string with displayed outline of
*        structure
* 
Author
Peter Gagarinov, PhD pgaga.nosp@m.rino.nosp@m.v@gma.nosp@m.il.c.nosp@m.om
Ilya Roublev, PhD iroub.nosp@m.lev@.nosp@m.gmail.nosp@m..com

◆ createArraySize()

static function mxberry::core::struct::StructDisp::createArraySize ( in  varName,
in  type 
)
staticprivate

◆ disp()

function mxberry::core::struct::StructDisp::disp ( in  self)

◆ formCellOfString()

static function mxberry::core::struct::StructDisp::formCellOfString ( in  strIndent,
in  fieldValue,
in  maxFieldLength,
in  filler,
in  FILLER_SYMBOL_CODE,
in  DASH_SYMBOL_CODE 
)
staticprivate

◆ getConstant()

static function mxberry::core::struct::StructDisp::getConstant ( in  constantName)
staticprivate

◆ getFieldName()

static function mxberry::core::struct::StructDisp::getFieldName ( in  fieldNameList,
in  iElem 
)
staticprivate

◆ getIndentation()

static function mxberry::core::struct::StructDisp::getIndentation ( in  indent)
staticprivate

x = ' | '; str = '';

 for iElem = 1 : indent
     str = cat(2, str, x);
 end

◆ getleaveslist()

static function mxberry::core::struct::StructDisp::getleaveslist ( in  SInp,
in  SOld,
in  isFullCheck 
)
staticprivate

GETLEAVESLIST generates a list of structure leaves paths.

 Input:
   regular:
     SInp: struct [] - input structure array
     SOld: struct [] - previous structure array to compare

 Output:
   regular:
     isLocalChanges: logical [1,1] - if true, then changes are local, i.e.
        changed are only values of fields; otherwise false, i.e. in the
        case when the fields of structure SInp themselves are changed in
        comparison to previous structure SOld
     pathCVec: char cell [nLeaves,1] - list with paths to leaves
     valCVec: cell [nLeaves,1] - list with values of leaves
   optional:
     isFullCheck: logical [1,1] - if true, then full check for consistency
        of inner structure for SInp and SOld is performed, otherwise it is
        supposed that SInp and SOld differ only in the values of their
        leaves and no check is performed
Author
Peter Gagarinov, PhD pgaga.nosp@m.rino.nosp@m.v@gma.nosp@m.il.c.nosp@m.om,
Ilya Roublev, PhD iroub.nosp@m.lev@.nosp@m.gmail.nosp@m..com

◆ getleaveslistint()

static function mxberry::core::struct::StructDisp::getleaveslistint ( in  SInp,
in  SOld,
in  fieldNameList 
)
staticprivate

◆ getRecFieldPrintAddArgs()

function mxberry::core::struct::StructDisp::getRecFieldPrintAddArgs ( in  self)
private

◆ initialize()

function mxberry::core::struct::StructDisp::initialize ( in  self,
in  SStructInp 
)
private

◆ parseArgList()

static function mxberry::core::struct::StructDisp::parseArgList ( in  argCVec)
staticprivate

◆ recFieldPrint()

static function mxberry::core::struct::StructDisp::recFieldPrint ( in  Structure,
in  indent,
in  printValues,
in  structureName,
in  maxArrayLength,
in  depth,
in  numberFormat,
in  DASH_SYMBOL_CODE,
in  FILLER_SYMBOL_CODE 
)
staticprivate

◆ strucdisp()

static function mxberry::core::struct::StructDisp::strucdisp ( in  varargin)
static

STRUCDISP display structure outline.

*  Usage: STRUCDISP(STRUC,fileName,'depth',DEPTH,'printValues',PRINTVALUES,. . .
*            'maxArrayLength',MAXARRAYLENGTH) stores
*         the hierarchical outline of a structure and its substructures into
*         the specified file
* 
*  input:
*    regular:
*        SInp: struct[1,1] - is a structure datatype with unknown field
*            content. It can be  either a scalar or a vector, but not a
*            matrix. STRUC is the only mandatory argument in this function.
*            All other arguments are optional.
* 
*    optional
*        fileName: char[1,] is the name of the file to which the output
*            should be printed. if this argument is not defined, the output
*            is printed to the command window.
* 
*    properties
*        depth: numeric[1,1] - the number of hierarchical levels of
*            the structure that are printed. If DEPTH is smaller than zero
*            all levels are printed. Default value for DEPTH is -1
*            (print all levels).
* 
*        printValues: logical[1,1] -  flag that states if the field values
*            should be printed  as well. The default value is 1 (print values)
* 
*        maxArrayLength: numberic[1,1] - a positive integer
*            which determines up to which length or size the values of
*            a vector or matrix are printed. For a  vector holds that
*            if the length of the vector is smaller or equal to
*            MAXARRAYLENGTH, the values are printed. If the vector is
*            longer than MAXARRAYLENGTH, then only the size of the
*            vector is printed. The values of a 2-dimensional (m,n)
*            array are printed if the number of elements (m x n) is
*            smaller or equal to MAXARRAYLENGTH. For vectors and arrays
*            this constraint overrides the PRINTVALUES flag.
*        numberFormat: char[1,] - format specification used for displaying
*            numberic values, passed directly to sprintf, by default '%g' is
*            used
*  output:
*    regular:
*        resStr: char [1,] - resulting string with displayed
*            structure contents
* 
Author
Peter Gagarinov, PhD pgaga.nosp@m.rino.nosp@m.v@gma.nosp@m.il.c.nosp@m.om
Ilya Roublev, PhD iroub.nosp@m.lev@.nosp@m.gmail.nosp@m..com

◆ update()

function mxberry::core::struct::StructDisp::update ( in  self,
in  SStructInp 
)

UPDATE quickly updates stored displayed outline by comparison of old and new values of structure, besides, some additional information concerning numbers of rows that were changed and for each of these row the corresponding number of column starting from which the change in this row was made.

*  Usage: update(self,SStructInp) OR
*         [changedRowIndVec,changedColIndVec]=. . .
*             update(self,SStructInp)
* 
*  input:
*    regular:
*      self: StructDisp [1,1] - class object containing previous
*          ("old") outline of structure
*      SStructInp: struct [1,1] - scalar structure containing
*          new structure
*  output:
*    optional:
*      changedRowIndVec: double [nRows,1] - numbers of rows in
*          which changes were made
*      changedColIndVec: double [nRows,1] - for each row in
*          changedRowIndVec the corresponding elemenent in this
*          array contain the number of column starting from
*          which the change was made
* 
Author
Peter Gagarinov, PhD pgaga.nosp@m.rino.nosp@m.v@gma.nosp@m.il.c.nosp@m.om
Ilya Roublev, PhD iroub.nosp@m.lev@.nosp@m.gmail.nosp@m..com

Member Data Documentation

◆ DASH_SYMBOL_CODE

Constant Property mxberry::core::struct::StructDisp::DASH_SYMBOL_CODE =45
private

Definition at line 302 of file StructDisp.m.

◆ DEFAULT_DEPTH

Constant Property mxberry::core::struct::StructDisp::DEFAULT_DEPTH =-1
private

Definition at line 306 of file StructDisp.m.

◆ DEFAULT_MAX_ARRAY_LENGTH

Constant Property mxberry::core::struct::StructDisp::DEFAULT_MAX_ARRAY_LENGTH =10
private

Definition at line 304 of file StructDisp.m.

◆ DEFAULT_NAME

Constant Property mxberry::core::struct::StructDisp::DEFAULT_NAME = 'Structure'
private

Definition at line 312 of file StructDisp.m.

◆ DEFAULT_NUMBER_FORMAT

Constant Property mxberry::core::struct::StructDisp::DEFAULT_NUMBER_FORMAT ='
private

Definition at line 310 of file StructDisp.m.

◆ DEFAULT_PRINT_VALUES

Constant Property mxberry::core::struct::StructDisp::DEFAULT_PRINT_VALUES =true
private

Definition at line 308 of file StructDisp.m.

◆ depth

Property mxberry::core::struct::StructDisp::depth
private

Definition at line 323 of file StructDisp.m.

◆ dispCVec

Property mxberry::core::struct::StructDisp::dispCVec
private

Definition at line 319 of file StructDisp.m.

◆ FILLER_SYMBOL_CODE

Constant Property mxberry::core::struct::StructDisp::FILLER_SYMBOL_CODE =32
private

Definition at line 300 of file StructDisp.m.

◆ inpPrintValues

Property mxberry::core::struct::StructDisp::inpPrintValues
private

Definition at line 325 of file StructDisp.m.

◆ isFullCheck

Property mxberry::core::struct::StructDisp::isFullCheck
private

Definition at line 333 of file StructDisp.m.

◆ maxArrayLength

Property mxberry::core::struct::StructDisp::maxArrayLength
private

Definition at line 327 of file StructDisp.m.

◆ numberFormat

Property mxberry::core::struct::StructDisp::numberFormat
private

Definition at line 329 of file StructDisp.m.

◆ SLeavesInfoVec

Property mxberry::core::struct::StructDisp::SLeavesInfoVec
private

Definition at line 321 of file StructDisp.m.

◆ SStruct

Property mxberry::core::struct::StructDisp::SStruct
private

Definition at line 317 of file StructDisp.m.

◆ structureName

Property mxberry::core::struct::StructDisp::structureName
private

Definition at line 331 of file StructDisp.m.


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