00001 #include "LinguisticDefinition/LingDef.h"
00002
00003 using namespace std;
00004 using namespace LinguisticDefinition;
00005
00009 LingDef::LingDef(const string &isoLanguageCode) :
00010 d_isoLanguageCode(isoLanguageCode) {
00011 }
00012
00016 LingDef::~LingDef() {
00017 {for (vector<Pos *>::iterator it = d_posDefs.begin();
00018 it != d_posDefs.end(); ++it) {
00019 delete *it;
00020 }}
00021
00022 {for (vector<Tree *>::iterator it = d_treeDefs.begin();
00023 it != d_treeDefs.end(); ++it) {
00024 delete *it;
00025 }}
00026
00027 {for (ConflictMap::iterator it = d_conflicts.begin();
00028 it != d_conflicts.end(); ++it) {
00029 delete (*it).second;
00030 }}
00031 }
00032
00036 LingDef::LingDef(const LingDef &o) :
00037 d_isoLanguageCode(o.d_isoLanguageCode) {
00038
00039 map<const Tree *, const Tree *> oldToNewTreeMap;
00040 map<const Tree::Node *, const Tree::Node *> oldToNewTreeNodeMap;
00041
00042 {for (vector<Tree *>::const_iterator it = o.d_treeDefs.begin();
00043 it != o.d_treeDefs.end(); ++it) {
00044 const Tree *oldTree = *it;
00045 Tree *newTree = new Tree(*oldTree);
00046 oldToNewTreeMap[oldTree] = newTree;
00047 addTree(newTree);
00048
00049 {for (Tree::NodeIterator it2 = oldTree->nodesBegin();
00050 it2 != oldTree->nodesEnd(); ++it2) {
00051 oldToNewTreeNodeMap[*it2] = newTree->getNode((*it2)->getName());
00052 }}
00053 }}
00054
00055 map<const Pos *, Pos *> oldToNewPosMap;
00056
00057 {for (vector<Pos *>::const_iterator it = o.d_posDefs.begin();
00058 it != o.d_posDefs.end(); ++it) {
00059 const Pos *oldPos = *it;
00060 Pos *newPos = new Pos(*oldPos);
00061 newPos->d_lingDef = this;
00062 {for (set<const Feature *>::iterator it2 = newPos->d_featureDefs.begin();
00063 it2 != newPos->d_featureDefs.end(); ++it2) {
00064 Feature *f = (Feature *) *it2;
00065 f->d_lingDef = this;
00066 f->d_posDef = newPos;
00067 if (f->d_tree != NULL) {
00068 f->d_tree = oldToNewTreeMap[f->d_tree];
00069 }
00070 if (f->d_treeNode != NULL) {
00071 f->d_treeNode = oldToNewTreeNodeMap[f->d_treeNode];
00072 }
00073 }}
00074
00075 oldToNewPosMap[oldPos] = newPos;
00076 addPos(newPos);
00077 }}
00078
00079 {for (vector<Pos *>::iterator it = d_posDefs.begin();
00080 it != d_posDefs.end(); ++it) {
00081 Pos *pos = *it;
00082
00083
00084 if (pos->d_superPos != NULL) {
00085 pos->d_superPos = oldToNewPosMap[pos->d_superPos];
00086 }
00087 }}
00088
00089 {for (ConflictMap::const_iterator it = o.d_conflicts.begin();
00090 it != o.d_conflicts.end(); ++it) {
00091 const Feature *oldKey = (*it).first;
00092 const Pos::FeatureList *oldValue = (*it).second;
00093
00094 const Pos *oldKeyPos = oldKey->getPosDef();
00095 const Pos *newKeyPos = oldToNewPosMap[oldKeyPos];
00096
00097 const Feature *newKey = newKeyPos->getFeature(oldKey->getName());
00098 Pos::FeatureList *newValue = new Pos::FeatureList;
00099
00100 d_conflicts[newKey] = newValue;
00101
00102 {for (Pos::FeatureIterator it2 = oldValue->begin();
00103 it2 != oldValue->end(); ++it2) {
00104 const Feature *oldConflictFeature = *it2;
00105 const Pos *oldPos = oldConflictFeature->getPosDef();
00106 const Pos *newPos = oldToNewPosMap[oldPos];
00107
00108 newValue->insert(newPos->getFeature(oldConflictFeature->getName()));
00109 }}
00110 }}
00111 }
00112
00116 LingDef &LingDef::operator=(const LingDef &o) {
00117 if (this != &o) {
00118 d_isoLanguageCode = o.d_isoLanguageCode;
00119
00120 {for (vector<Pos *>::iterator it = d_posDefs.begin();
00121 it != d_posDefs.end(); ++it) {
00122 delete *it;
00123 }}
00124
00125 d_posDefs.clear();
00126 d_posNameMap.clear();
00127
00128 {for (vector<Pos *>::const_iterator it = o.d_posDefs.begin();
00129 it != o.d_posDefs.end(); ++it) {
00130 addPos(new Pos(**it));
00131 }}
00132 }
00133 return *this;
00134 }
00135
00139 const string &LingDef::getIsoLanguageCode() const {
00140 return d_isoLanguageCode;
00141 }
00142
00146 LingDef::Pos::Pos &LingDef::createPos(const string &name) {
00147 Pos *pos = new Pos(*this, name);
00148 addPos(pos);
00149 return *pos;
00150 }
00151
00155 LingDef::Pos::Pos &LingDef::Pos::createSubPos(const string &name) {
00156 Pos *pos = new Pos(*this, name);
00157 d_lingDef->addPos(pos);
00158 return *pos;
00159 }
00160
00164 LingDef::Pos::Pos &LingDef::createVirtualPos() {
00165 return createPos("");
00166 }
00167
00171 LingDef::Pos::Pos &LingDef::Pos::createVirtualSubPos() {
00172 return createSubPos("");
00173 }
00174
00178 LingDef::Pos::Pos(LingDef &lingDef,
00179 const string &name) :
00180 d_lingDef(&lingDef),
00181 d_superPos(NULL),
00182 d_name(name) {
00183 }
00184
00188 LingDef::Pos::Pos(Pos &superPos,
00189 const string &name) :
00190 d_lingDef(superPos.d_lingDef),
00191 d_superPos(&superPos),
00192 d_name(name) {
00193 }
00194
00198 LingDef::Pos::Pos(const Pos &o) :
00199 d_lingDef(o.d_lingDef),
00200 d_superPos(o.d_superPos),
00201 d_name(o.d_name),
00202 d_shortName(o.d_shortName),
00203 d_type(o.d_type),
00204 d_note(o.d_note) {
00205
00206 if (this != &o) {
00207 vector<Feature *> newFeatures;
00208 map<Feature *, const Feature *> newToOldMap;
00209 map<const Feature *, Feature *> oldToNewMap;
00210 {for (set<const Feature *>::const_iterator
00211 it = o.d_featureDefs.begin();
00212 it != o.d_featureDefs.end(); ++it) {
00213 const Feature *oldFeature = *it;
00214 Feature *newFeature = new Feature(*oldFeature);
00215
00216 addFeature(newFeature);
00217 newToOldMap[newFeature] = oldFeature;
00218 oldToNewMap[*it] = newFeature;
00219 newFeatures.push_back(newFeature);
00220 }}
00221
00222 {for (vector<Feature *>::iterator it = newFeatures.begin();
00223 it != newFeatures.end(); ++it) {
00224 Feature *newFeature = *it;
00225
00226 if (newFeature->d_parentEnum != NULL) {
00227 newFeature->d_parentEnum = oldToNewMap[newFeature->d_parentEnum];
00228 }
00229
00230 const Feature *oldFeature = newToOldMap[newFeature];
00231 newFeature->d_enumChildren.clear();
00232 {for (set<Feature *>::const_iterator
00233 it2 = oldFeature->d_enumChildren.begin();
00234 it2 != oldFeature->d_enumChildren.end(); ++it2) {
00235 newFeature->d_enumChildren.insert(oldToNewMap[*it2]);
00236 }}
00237 }}
00238 }
00239 }
00240
00244 LingDef::Pos &LingDef::Pos::operator=(const Pos &o) {
00245 d_lingDef = o.d_lingDef;
00246 d_superPos = o.d_superPos;
00247 d_name = o.d_name;
00248 d_shortName = o.d_shortName;
00249 d_type = o.d_type;
00250 d_note = o.d_note;
00251 if (this != &o) {
00252
00253 {for (set<const Feature *>::iterator it = d_featureDefs.begin();
00254 it != d_featureDefs.end(); ++it) {
00255 delete *it;
00256 }}
00257
00258 d_featureDefs.clear();
00259 d_featureNameMap.clear();
00260 d_defaultFeatures.clear();
00261
00262 {for (set<const Feature *>::iterator it = o.d_featureDefs.begin();
00263 it != o.d_featureDefs.end(); ++it) {
00264 addFeature(new Feature(**it));
00265 }}
00266 }
00267
00268 return *this;
00269 }
00270
00274 LingDef::Pos::~Pos() {
00275 {for (set<const Feature *>::iterator it = d_featureDefs.begin();
00276 it != d_featureDefs.end(); ++it) {
00277 delete *it;
00278 }}
00279 }
00280
00284 const string &LingDef::Pos::getName() const {
00285 return d_name;
00286 }
00287
00291 void LingDef::Pos::setShortName(const string &val) {
00292 d_shortName = val;
00293 if (d_lingDef != NULL && val != "") {
00294 d_lingDef->d_posShortNameMap[val] = this;
00295 }
00296 }
00297
00301 const string &LingDef::Pos::getShortName() const {
00302 return d_shortName;
00303 }
00304
00308 const LingDef *LingDef::Pos::getLingDef() const {
00309 return d_lingDef;
00310 }
00311
00315 const LingDef::Pos *LingDef::Pos::getSuperPos() const {
00316 return d_superPos;
00317 }
00318
00322 void LingDef::addPos(LingDef::Pos *pos) {
00323 d_posDefs.push_back(pos);
00324 if (pos->getName() != "") {
00325 d_posNameMap[pos->getName()] = pos;
00326 }
00327 }
00328
00332 const LingDef::Pos *LingDef::getPos(const string &id) const {
00333 map<string, Pos *>::const_iterator findIt = d_posNameMap.find(id);
00334 if (findIt == d_posNameMap.end()) {
00335 map<string, Pos *>::const_iterator findIt2 = d_posShortNameMap.find(id);
00336 if (findIt2 == d_posShortNameMap.end()) {
00337 return NULL;
00338 }
00339 return (*findIt2).second;
00340 }
00341 return (*findIt).second;
00342 }
00343
00347 void LingDef::Pos::setType(LingDef::Pos::Type type) {
00348 d_type = type;
00349 }
00350
00354 LingDef::Pos::Type LingDef::Pos::getType() const {
00355 return d_type;
00356 }
00357
00361 void LingDef::Pos::setNote(const string &val) {
00362 d_note = val;
00363 }
00364
00368 LingDef::Feature &LingDef::Pos::createFeature(const string &name,
00369 LingDef::Feature::Domain domain,
00370 LingDef::Feature::Type type) {
00371 Feature *feature = new Feature(*this, name, domain, type);
00372 addFeature(feature);
00373 return *feature;
00374 }
00375
00379 LingDef::Feature &
00380 LingDef::Feature::createEnumValueFeature(const string &name) {
00381 bool firstValue = d_enumChildren.empty();
00382
00383 Feature *feature = new Feature(*this, name);
00384
00385 d_posDef->addFeature(feature);
00386
00387 if (firstValue && !allowNoValue()) {
00388 feature->setDefault(true);
00389 }
00390
00391 return *feature;
00392 }
00393
00397 void LingDef::Pos::addFeature(LingDef::Feature *feature) {
00398 d_featureDefs.insert(feature);
00399 d_featureNameMap[feature->getName()] = feature;
00400 }
00401
00405 LingDef::Pos::FeatureIterator LingDef::Pos::featuresBegin() const {
00406 return d_featureDefs.begin();
00407 }
00408
00412 LingDef::Pos::FeatureIterator LingDef::Pos::featuresEnd() const {
00413 return d_featureDefs.end();
00414 }
00415
00419 LingDef::Pos::FeatureIterator LingDef::Pos::defaultFeaturesBegin() const {
00420 return d_defaultFeatures.begin();
00421 }
00422
00426 LingDef::Pos::FeatureIterator LingDef::Pos::defaultFeaturesEnd() const {
00427 return d_defaultFeatures.end();
00428 }
00429
00433 void LingDef::Feature::addConflict(const LingDef::Feature &feature) {
00434 if (d_lingDef != NULL) {
00435 d_lingDef->addConflict(*this, feature);
00436 }
00437 }
00438
00442 void LingDef::addConflict(const LingDef::Feature &featureA,
00443 const LingDef::Feature &featureB) {
00444
00445
00446 {
00447 Pos::FeatureList *conflictSet = NULL;
00448 ConflictMap::const_iterator findIt = d_conflicts.find(&featureA);
00449 if (findIt == d_conflicts.end()) {
00450 conflictSet = new Pos::FeatureList;
00451 d_conflicts[&featureA] = conflictSet;
00452 } else {
00453 conflictSet = (*findIt).second;
00454 }
00455 conflictSet->insert(&featureB);
00456 }
00457
00458
00459 {
00460 Pos::FeatureList *conflictSet = NULL;
00461 ConflictMap::const_iterator findIt = d_conflicts.find(&featureB);
00462 if (findIt == d_conflicts.end()) {
00463 conflictSet = new Pos::FeatureList;
00464 d_conflicts[&featureB] = conflictSet;
00465 } else {
00466 conflictSet = (*findIt).second;
00467 }
00468 conflictSet->insert(&featureA);
00469 }
00470 }
00471
00475 const LingDef::Pos::FeatureList *
00476 LingDef::getConflicts(const Feature &feature) const {
00477 ConflictMap::const_iterator findIt = d_conflicts.find(&feature);
00478 if (findIt == d_conflicts.end()) {
00479 return NULL;
00480 }
00481 return (*findIt).second;
00482 }
00483
00487 LingDef::Feature::Feature(LingDef::Pos &posDef,
00488 const string &name,
00489 LingDef::Feature::Domain domain,
00490 LingDef::Feature::Type type) :
00491 d_lingDef(posDef.d_lingDef),
00492 d_posDef(&posDef),
00493 d_name(name),
00494 d_domain(domain),
00495 d_type(type),
00496 d_parentEnum(NULL),
00497 d_allowSeveralValues(false),
00498 d_allowNoValue(true),
00499 d_isDefault(false),
00500 d_tree(NULL),
00501 d_treeNode(NULL) {
00502 }
00503
00507 LingDef::Feature::Feature(LingDef::Feature &parentEnum,
00508 const string &name) :
00509 d_lingDef(parentEnum.d_lingDef),
00510 d_posDef(parentEnum.d_posDef),
00511 d_name(name),
00512 d_domain(parentEnum.d_domain),
00513 d_type(BOOLEAN),
00514 d_parentEnum(&parentEnum),
00515 d_allowSeveralValues(false),
00516 d_allowNoValue(true),
00517 d_isDefault(false),
00518 d_tree(NULL),
00519 d_treeNode(NULL) {
00520
00521 d_parentEnum->d_enumChildren.insert(this);
00522 }
00523
00527 LingDef::Feature::~Feature() {
00528 }
00529
00533 const string &LingDef::Feature::getName() const {
00534 return d_name;
00535 }
00536
00537
00541 const LingDef *LingDef::Feature::getLingDef() const {
00542 return d_lingDef;
00543 }
00544
00548 const LingDef::Pos *LingDef::Feature::getPosDef() const {
00549 return d_posDef;
00550 }
00551
00555 const LingDef::Feature *LingDef::Pos::getFeature(const string &name)
00556 const {
00557
00558
00559
00560 map<string, const Feature *>::const_iterator
00561 findIt = d_featureNameMap.find(name);
00562 if (findIt == d_featureNameMap.end()) {
00563 const Pos *superPos = getSuperPos();
00564 if (superPos != NULL) {
00565 const Feature *superPosFeature = superPos->getFeature(name);
00566 if (superPosFeature == NULL) {
00567 map<string, const Feature *>::const_iterator findIt2 =
00568 d_featureShortNameMap.find(name);
00569 if (findIt2 == d_featureShortNameMap.end()) {
00570 return NULL;
00571 }
00572 return (*findIt2).second;
00573 }
00574 return superPosFeature;
00575 }
00576 return NULL;
00577 }
00578
00579 return (*findIt).second;
00580 }
00581
00585 LingDef::Feature::Domain LingDef::Feature::getDomain() const {
00586 if (d_parentEnum != NULL) {
00587 return d_parentEnum->getDomain();
00588 }
00589 return d_domain;
00590 }
00591
00595 LingDef::Feature::Type LingDef::Feature::getType() const {
00596 return d_type;
00597 }
00598
00602 const LingDef::Feature *LingDef::Feature::getParentEnum() const {
00603 return d_parentEnum;
00604 }
00605
00609 bool LingDef::Feature::
00610 isIn(const set<const LingDef::Feature *> &featureSet) const {
00611 if (featureSet.find(this) != featureSet.end()) {
00612 return true;
00613 }
00614
00615
00616 const Tree::Node *treeNode = getTreeNode();
00617 if (treeNode != NULL) {
00618 {for (set<const LingDef::Feature *>::const_iterator
00619 it = featureSet.begin();
00620 it != featureSet.end(); ++it) {
00621
00622 const Tree::Node *otherTreeNode = (*it)->getTreeNode();
00623 if (otherTreeNode != NULL) {
00624
00625 if (treeNode->isAncestorOf(*otherTreeNode)) {
00626 return true;
00627 }
00628 }
00629 }}
00630 }
00631
00632
00633 return false;
00634 }
00635
00639 void LingDef::Feature::setAllowSeveralValues(bool val) {
00640 d_allowSeveralValues = val;
00641 }
00642
00646 bool LingDef::Feature::allowSeveralValues() const {
00647 return d_allowSeveralValues;
00648 }
00649
00653 void LingDef::Feature::setAllowNoValue(bool val) {
00654 d_allowNoValue = val;
00655 }
00656
00660 bool LingDef::Feature::allowNoValue() const {
00661 return d_allowNoValue;
00662 }
00663
00667 void LingDef::Feature::setDefault(bool val) {
00668 setDefaultSub(val, true);
00669 }
00670
00674 void LingDef::Feature::setDefaultSub(bool val, bool goThroughSiblings) {
00675 if (val != d_isDefault) {
00676 if (d_posDef != NULL) {
00677 if (val) {
00678 d_posDef->d_defaultFeatures.insert(this);
00679
00680 if (goThroughSiblings) {
00681 const Feature *parentEnum = getParentEnum();
00682 if (parentEnum != NULL) {
00683
00684 {for (set<Feature *>::iterator it =
00685 parentEnum->d_enumChildren.begin();
00686 it != parentEnum->d_enumChildren.end(); ++it) {
00687 (*it)->setDefaultSub(false, false);
00688 }}
00689 }
00690 }
00691
00692 } else {
00693 d_posDef->d_defaultFeatures.erase(this);
00694
00695 if (goThroughSiblings && !allowNoValue()) {
00696
00697 }
00698 }
00699 }
00700 d_isDefault = val;
00701 }
00702 }
00703
00707 bool LingDef::Feature::isDefault() const {
00708 return d_isDefault;
00709 }
00710
00714 void LingDef::Feature::setShortName(const string &val) {
00715 d_shortName = val;
00716 if (d_posDef != NULL && val != "") {
00717 d_posDef->d_featureShortNameMap[val] = this;
00718 }
00719 }
00720
00724 const string &LingDef::Feature::getShortName() const {
00725 return d_shortName;
00726 }
00727
00731 const LingDef::Tree *LingDef::Feature::getTree() const {
00732 return d_tree;
00733 }
00734
00739 void LingDef::Feature::setTree(const LingDef::Tree &tree) {
00740 d_tree = &tree;
00741 {for (Tree::NodeIterator it = tree.nodesBegin();
00742 it != tree.nodesEnd(); ++it) {
00743 const Tree::Node *node = *it;
00744 Feature &nodeFeature = createEnumValueFeature(node->getName());
00745 nodeFeature.d_tree = &tree;
00746 nodeFeature.d_treeNode = node;
00747 }}
00748 }
00749
00753 const LingDef::Tree::Node *LingDef::Feature::getTreeNode() const {
00754 return d_treeNode;
00755 }
00756
00760 LingDef::Tree &LingDef::createTree(const string &name) {
00761 Tree *tree = new Tree(name);
00762 addTree(tree);
00763 return *tree;
00764 }
00765
00769 const LingDef::Tree *LingDef::getTree(const string &name) const {
00770 map<string, Tree *>::const_iterator findIt = d_treeNameMap.find(name);
00771 if (findIt == d_treeNameMap.end()) {
00772 return NULL;
00773 }
00774 return (*findIt).second;
00775 }
00776
00780 void LingDef::addTree(LingDef::Tree *tree) {
00781 d_treeDefs.push_back(tree);
00782 if (tree->getName() != "") {
00783 d_treeNameMap[tree->getName()] = tree;
00784 }
00785 }
00786
00790 LingDef::Tree::Tree(const Tree &o) :
00791 d_name(o.d_name),
00792 d_rootNode(o.d_rootNode) {
00793
00794 map<const Node *, Node *> oldToNewMap;
00795 {for (NodeIterator it = o.nodesBegin(); it != o.nodesEnd(); ++it) {
00796 const Node *oldNode = *it;
00797 Node *newNode = new Node(*oldNode);
00798 newNode->d_parentTree = this;
00799 oldToNewMap[oldNode] = newNode;
00800 d_nodes.push_back(newNode);
00801 d_nodeNameMap[newNode->getName()] = newNode;
00802 }}
00803
00804
00805
00806 {for (multimap<const Node *, const Node *>::const_iterator
00807 it = o.d_ancestorsMap.begin();
00808 it != o.d_ancestorsMap.end(); ++it) {
00809 pair<const Node *, const Node *> p(oldToNewMap[(*it).first],
00810 oldToNewMap[(*it).second]);
00811 d_ancestorsMap.insert(p);
00812 d_grandChildAncestorPairSet.insert(p);
00813 }}
00814 }
00815
00819 LingDef::Tree::Tree(const string &name) :
00820 d_name(name),
00821 d_rootNode(*this, "") {
00822 }
00823
00827 LingDef::Tree::~Tree() {
00828 {for (NodeIterator it = nodesBegin(); it != nodesEnd(); ++it) {
00829 delete *it;
00830 }}
00831 }
00832
00836 const string &LingDef::Tree::getName() const {
00837 return d_name;
00838 }
00839
00843 LingDef::Tree::Node::Node(LingDef::Tree &parentTree, const string &name) :
00844 d_parentTree(&parentTree),
00845 d_name(name) {
00846 }
00847
00851 LingDef::Tree::Node::~Node() {
00852 }
00853
00857 LingDef::Tree::Node &LingDef::Tree::Node::createChildNode(const string &name) {
00858 Node *node = new Node(*d_parentTree, name);
00859 d_parentTree->d_nodes.push_back(node);
00860 d_parentTree->d_nodeNameMap[name] = node;
00861
00862
00863
00864
00865
00866 {
00867 vector<const Node *> newAncestors;
00868 if (this != &d_parentTree->d_rootNode) {
00869 newAncestors.push_back(this);
00870 }
00871 {for (multimap<const Node *, const Node *>::iterator
00872 it = d_parentTree->d_ancestorsMap.find(this);
00873 it != d_parentTree->d_ancestorsMap.end() && (*it).first == this;
00874 ++it) {
00875 const Node *ancestorNode = (*it).second;
00876 if (ancestorNode != &d_parentTree->d_rootNode) {
00877 newAncestors.push_back(ancestorNode);
00878 }
00879 }}
00880 {for (vector<const Node *>::iterator it = newAncestors.begin();
00881 it != newAncestors.end(); ++it) {
00882 pair<const Node *, const Node *> p(node, *it);
00883 d_parentTree->d_ancestorsMap.insert(p);
00884 d_parentTree->d_grandChildAncestorPairSet.insert(p);
00885 }}
00886 }
00887
00888 return *node;
00889 }
00890
00894 LingDef::Tree &LingDef::Tree::Node::getParentTree() const {
00895 return *d_parentTree;
00896 }
00897
00901 const string &LingDef::Tree::Node::getName() const {
00902 return d_name;
00903 }
00904
00908 LingDef::Tree::Node &LingDef::Tree::getRootNode() {
00909 return d_rootNode;
00910 }
00911
00915 const LingDef::Tree::Node *LingDef::Tree::getNode(const string &name) const {
00916 map<string, Node *>::const_iterator findIt = d_nodeNameMap.find(name);
00917 if (findIt == d_nodeNameMap.end()) {
00918 return NULL;
00919 }
00920 return (*findIt).second;
00921 }
00922
00926 bool LingDef::Tree::Node::isAncestorOf(const Node &grandChild) const {
00927 pair<const Node *, const Node *> p(&grandChild, this);
00928 return
00929 d_parentTree->d_grandChildAncestorPairSet.find(p)
00930 !=
00931 d_parentTree->d_grandChildAncestorPairSet.end();
00932 }
00933
00937 LingDef::Tree::NodeIterator LingDef::Tree::nodesBegin() const {
00938 return d_nodes.begin();
00939 }
00940
00944 LingDef::Tree::NodeIterator LingDef::Tree::nodesEnd() const {
00945 return d_nodes.end();
00946 }
00947