Classes. More...
#include <gclasses.h>
Public Member Functions | |
GClasses (GSession *session, size_t max) | |
GClasses * | GetClassTree (void) |
GClass * | GetFirst (void) const |
GClass * | GetLast (void) const |
size_t | GetMaxDepth (void) const |
size_t | GetNbNodes (void) const |
size_t | GetNbTopNodes (void) const |
size_t | GetTab (GClass **tab, GClass *node, bool children=false) |
size_t | GetNbObjs (const GClass *obj) const |
size_t | GetMaxObjId (const GClass *obj) const |
size_t | GetMaxObjPos (const GClass *obj) const |
R::RCursor< GClass > | GetObjs (const GClass *obj) const |
size_t | GetObjs (GClass **&tab, bool alloc) |
GClass * | GetObj (const GClass *obj, size_t id, bool load=true, bool null=false) |
GClass * | GetObj (const GClass *obj, const R::RString &name, bool load=true, bool null=false) |
void | LoadIndex (const GClass *obj, GConcept *concept, R::RNumContainer< size_t, true > &refs) |
void | BuildIndex (const GClass *obj) |
virtual void | InsertObj (GClass *parent, GClass *obj) |
virtual void | DeleteObj (GClass *obj) |
double | GetUpOperationsCost (const GClass *u, const GClass *v) const |
Private Member Functions | |
void | Init (R::RConfig *config) |
void | OpenFiles (R::RConfig *config, R::RString subdir) |
bool | DoCreateIndex (const GClass *obj) const |
bool | DoCreateTree (const GClass *obj) const |
void | AssignId (GClass *obj) |
void | LoadObjs (const GClass *obj) |
void | LoadDesc (const GClass *obj, R::RContainer< GVector, true, true > *&vectors, size_t blockid, size_t id) |
void | SaveDesc (const GClass *obj, const R::RContainer< GVector, true, true > &vectors, size_t &blockid, size_t id) |
void | FlushDesc (const GClass *obj) |
void | UpdateIndex (const GClass *obj, const GDescription &desc, size_t id, bool add) |
virtual void | Clear (void) |
virtual void | Clear (const GClass *obj, bool del) |
Private Member Functions inherited from RTree< GClasses, GClass, false > | |
RTree (void) | |
void | ClearNode (GClass *node) |
GClass * | GetFirst (void) const |
GClass * | GetLast (void) const |
size_t | GetMaxDepth (void) const |
GClass * | GetTop (void) |
const GClass * | GetTop (void) const |
size_t | GetNbNodes (void) const |
size_t | GetNbTopNodes (void) const |
size_t | GetTab (GClass **tab, GClass *node, bool children=false) |
void | InsertNode (GClass *to, GClass *node) |
void | DeleteNodes (GClass *node, bool del=false) |
void | DeleteNode (GClass *node, bool del=false) |
void | UpdateDepth (GClass *node) |
void | MoveNode (GClass *to, GClass *node) |
void | Copy (const RTree< GClasses, GClass, a > &src) |
void | DeepCopy (GClass *src, GClass *newparent) |
GClass * | GetNode (const TUse &tag) const |
double | GetUpOperationsCost (const GClass *u, const GClass *v) const |
virtual | ~RTree (void) |
Private Member Functions inherited from GObjects< GClass, hClasses > | |
GObjects (GSession *session, size_t size, const R::RString &name, tObjType type) | |
size_t | GetNbObjs (const GClass *obj) const |
size_t | GetMaxObjId (const GClass *obj) const |
size_t | GetMaxObjPos (const GClass *obj) const |
R::RCursor< GClass > | GetObjs (const GClass *obj) const |
size_t | GetObjs (GClass **&tab, bool alloc) |
GClass * | GetObj (const GClass *obj, size_t id, bool load=true, bool null=false) |
GClass * | GetObj (const GClass *obj, const R::RString &name, bool load=true, bool null=false) |
void | LoadIndex (const GClass *obj, GConcept *concept, R::RNumContainer< size_t, true > &refs) |
void | BuildIndex (const GClass *obj) |
void | LoadTree (const GClass *obj, GConceptTree *&tree, size_t blockid, size_t id) |
void | LoadTree (const GClass *obj, R::RContainer< GConceptRecord, false, true > &records, size_t &nbrecords, size_t &nbtoprecords, size_t &nbrefs) |
bool | FindDepthFirstRecord (const GClass *obj, GConceptRecord &rec, size_t idx) |
bool | FindRecord (const GClass *obj, GConceptRecord &rec, size_t synpos) |
bool | FindParentRecord (const GClass *obj, const GConceptRecord &search, GConceptRecord &rec) |
bool | FindFirstChildRecord (const GClass *obj, const GConceptRecord &search, GConceptRecord &rec, size_t idx) |
bool | FindNearestRecord (const GClass *obj, GConceptRecord &rec, size_t synpos) |
bool | FindNearestRecord (const GClass *obj, GConceptRecord &rec, size_t synpos, bool after) |
bool | FindRootRecord (const GClass *obj, const GConceptRecord &rec1, const GConceptRecord &rec2, GConceptRecord &rec) |
size_t | GetMinPosRecord (const GClass *obj, const GConceptRecord &rec, size_t nbbefore) |
size_t | GetMaxPosRecord (const GClass *obj, const GConceptRecord &rec, size_t nbafter) |
size_t | GetMaxPosRecord (const GClass *obj) |
size_t | GetMaxSyntacticPosRecord (const GClass *obj) |
size_t | GetNbTotalChildRecords (const GClass *obj, const GConceptRecord &rec) |
virtual | ~GObjects (void) |
Additional Inherited Members | |
Private Attributes inherited from RTree< GClasses, GClass, false > | |
GClass * | First |
GClass * | Last |
size_t | NbTopNodes |
size_t | NbNodes |
size_t | MaxDepth |
Detailed Description
Constructor & Destructor Documentation
Construct a tree of classes.
- Parameters
-
session Session. max Initial size of the container.
Member Function Documentation
GClasses* GetClassTree | ( | void | ) |
- Returns
- Pointer to the class.
GClass* GetFirst | ( | void | ) | const |
- Returns
- the first root class. If null, the tree is empty.
GClass* GetLast | ( | void | ) | const |
- Returns
- the last root class. If null, the tree is empty.
size_t GetMaxDepth | ( | void | ) | const |
- Returns
- the depth of the tree. If necessary, the depth is recomputed.
size_t GetNbNodes | ( | void | ) | const |
- Returns
- the total number of classes in the tree.
size_t GetNbTopNodes | ( | void | ) | const |
- Returns
- the total number of top classes in the tree.
Copy the classes of a class into a temporary array. This array must have the right size.
- Parameters
-
tab Temporary array. node Parent class. If null, the array contains the top classes. children Must the children be copied too.
- Returns
- Number of the nodes copied in the array
size_t GetNbObjs | ( | const GClass * | obj | ) | const |
Get the number of classes.
- Parameters
-
obj Pseudo-parameter.
size_t GetMaxObjId | ( | const GClass * | obj | ) | const |
Get the highest identifier of the classes.
- Parameters
-
obj Pseudo-parameter.
size_t GetMaxObjPos | ( | const GClass * | obj | ) | const |
Get the highest position occupied by a clas.
- Parameters
-
obj Pseudo-parameter.
R::RCursor<GClass> GetObjs | ( | const GClass * | obj | ) | const |
Get a cursor to the classes.
- Parameters
-
obj Pseudo-parameter.
size_t GetObjs | ( | GClass **& | tab, |
bool | alloc | ||
) |
Fill an array of classes.
- Parameters
-
tab Array that will be filled. alloc Must the array be allocated ?
- Returns
- number of objects in the array (including null pointers).
Get an class based on its identifier.
- Parameters
-
obj Pseudo-parameter. id Identifier of the class. load If set to true, the class is eventually loaded into memory. null If set to true, if the class does not exist, return 0, else an exception is generated.
- Returns
- a pointer to a class.
GClass* GetObj | ( | const GClass * | obj, |
const R::RString & | name, | ||
bool | load = true , |
||
bool | null = false |
||
) |
Get an class based on its name.
- Parameters
-
obj Pseudo-parameter. name Name of the class. load If set to true, the class is eventually loaded into memory. null If set to true, if the class does not exist, return 0, else an exception is generated.
- Returns
- a pointer to a class.
void LoadIndex | ( | const GClass * | obj, |
GConcept * | concept, | ||
R::RNumContainer< size_t, true > & | refs | ||
) |
Load the identifiers of all classes described by a specific concept.
- Parameters
-
obj Pseudo-parameter. concept Concept to search for. refs Identifiers of the classes.
void BuildIndex | ( | const GClass * | obj | ) |
Build the index of all the classes from scratch. Since only the class descriptions are used, no occurrence information is* available.
- Parameters
-
obj Pseudo-parameter.
Insert a class.
- Parameters
-
parent Parent class. obj object to insert.
Reimplemented from GObjects< GClass, hClasses >.
|
virtual |
|
private |
Initialize the parameters.
- Parameters
-
config Configuration structure.
|
private |
Open the files in a given directory.
- Parameters
-
config Configuration structure. subdir Sub-directory where the files will be stored.
|
private |
- Returns
- if an index is create.
- Parameters
-
obj Pseudo-parameter.
|
private |
- Returns
- if the concept trees are created.
- Parameters
-
obj Pseudo-parameter.
|
private |
Assign an identifier to an class.
- Parameters
-
obj Class.
|
private |
Load all the classes.
- Parameters
-
obj Pseudo-parameter.
|
private |
Load the description of a given class.
- Parameters
-
obj Pseudo-parameter. vectors Vectors. blockid Identifier of the block of the class. id Identifier of the class.
|
private |
Save the description of a given class.
- Parameters
-
obj Pseudo-parameter. vectors Vectors. blockid Identifier of the block of the class (0 means the block will be found). id Identifier of the class.
|
private |
Flush the descriptions of the classes.
- Parameters
-
obj Pseudo-parameter.
|
private |
Update the index of a given class that is only described by a description.
- Parameters
-
obj Pseudo-parameter. desc Description. id Identifier of the class. add Class must be added or removed from the index.
|
privatevirtual |
Clear the classes.
Reimplemented from RTree< GClasses, GClass, false >.
|
privatevirtual |
Get the cost of the Up operations to move a token from a node to another one.
In their paper TreeRank: A Similarity Measure for Nearest Neighbor Searching in Phylogenetic Databases, Wang, Shan, Shasha and Piel define a similarity measure between two trees based on the different costs of up operations of the nodes of each tree.
- Parameters
-
u First node. v Second node.
- Returns
- Cost of the up operations.