finished converting TargetPhraseCollection* to TargetPhraseCollection

This commit is contained in:
Hieu Hoang 2013-07-16 16:55:56 +01:00
parent e1a86bd9c9
commit f3e0fd2dd4
5 changed files with 10 additions and 14 deletions

View File

@ -154,12 +154,10 @@ void ChartRuleLookupManagerMemory::GetChartRuleCollection(
const PhraseDictionaryNodeMemory &node = dottedRule.GetLastNode();
// look up target sides
const TargetPhraseCollection *tpc = node.GetTargetPhraseCollection();
const TargetPhraseCollection &tpc = node.GetTargetPhraseCollection();
// add the fully expanded rule (with lexical target side)
if (tpc != NULL) {
AddCompletedRule(dottedRule, *tpc, range, outColl);
}
AddCompletedRule(dottedRule, tpc, range, outColl);
}
dottedRuleCol.Clear(relEndPos+1);

View File

@ -153,12 +153,10 @@ void ChartRuleLookupManagerMemoryPerSentence::GetChartRuleCollection(
const PhraseDictionaryNodeMemory &node = dottedRule.GetLastNode();
// look up target sides
const TargetPhraseCollection *tpc = node.GetTargetPhraseCollection();
const TargetPhraseCollection &tpc = node.GetTargetPhraseCollection();
// add the fully expanded rule (with lexical target side)
if (tpc != NULL) {
AddCompletedRule(dottedRule, *tpc, range, outColl);
}
AddCompletedRule(dottedRule, tpc, range, outColl);
}
dottedRuleCol.Clear(relEndPos+1);

View File

@ -51,7 +51,7 @@ TargetPhraseCollection &PhraseDictionaryMemory::GetOrCreateTargetPhraseCollectio
, const Word *sourceLHS)
{
PhraseDictionaryNodeMemory &currNode = GetOrCreateNode(source, target, sourceLHS);
return currNode.GetOrCreateTargetPhraseCollection();
return currNode.GetTargetPhraseCollection();
}
const TargetPhraseCollection *PhraseDictionaryMemory::GetTargetPhraseCollection(const Phrase& sourceOrig) const
@ -70,7 +70,7 @@ const TargetPhraseCollection *PhraseDictionaryMemory::GetTargetPhraseCollection(
return NULL;
}
return currNode->GetTargetPhraseCollection();
return &currNode->GetTargetPhraseCollection();
}
PhraseDictionaryNodeMemory &PhraseDictionaryMemory::GetOrCreateNode(const Phrase &source

View File

@ -133,10 +133,10 @@ public:
const PhraseDictionaryNodeMemory *GetChild(const Word &sourceTerm) const;
const PhraseDictionaryNodeMemory *GetChild(const Word &sourceNonTerm, const Word &targetNonTerm) const;
const TargetPhraseCollection *GetTargetPhraseCollection() const {
return &m_targetPhraseCollection;
const TargetPhraseCollection &GetTargetPhraseCollection() const {
return m_targetPhraseCollection;
}
TargetPhraseCollection &GetOrCreateTargetPhraseCollection() {
TargetPhraseCollection &GetTargetPhraseCollection() {
return m_targetPhraseCollection;
}

View File

@ -263,7 +263,7 @@ TargetPhraseCollection &PhraseDictionaryFuzzyMatch::GetOrCreateTargetPhraseColle
, const Word *sourceLHS)
{
PhraseDictionaryNodeMemory &currNode = GetOrCreateNode(rootNode, source, target, sourceLHS);
return currNode.GetOrCreateTargetPhraseCollection();
return currNode.GetTargetPhraseCollection();
}
PhraseDictionaryNodeMemory &PhraseDictionaryFuzzyMatch::GetOrCreateNode(PhraseDictionaryNodeMemory &rootNode