SentencePattern.h

Go to the documentation of this file.
00001 #ifndef _LINGUISTICDEFINITION_SENTENCEPATTERN_H_
00002 #define _LINGUISTICDEFINITION_SENTENCEPATTERN_H_
00003 
00004 #include <string>
00005 #include <vector>
00006 #include <set>
00007 
00008 #include "LingDef.h"
00009 #include "LingFeaturesSet.h"
00010 #include "WordPattern.h"
00011 
00012 //TODO: matching in own class?
00013 //TODO: references! allow in or's or what? how does it map to transfer rules?
00014 
00015 namespace LinguisticDefinition {
00016 
00020   class SentencePattern {
00021   public:
00022 
00026     SentencePattern();
00027 
00031     ~SentencePattern();
00032 
00036     SentencePattern(const SentencePattern &);
00037 
00041     bool hasEndOperator() const;
00042 
00046     bool hasBeginningOperator() const;
00047 
00051     void setEndOperator(bool = true);
00052 
00056     void setBeginningOperator(bool = true);
00057 
00061     class Element {
00062       friend class SentencePattern;
00063     public:
00064 
00068       Element(const SentencePattern &, int listPosition);
00069 
00073       const SentencePattern &getSentencePattern() const;
00074 
00078       const WordPattern &getWordPattern() const;
00079 
00083       const WordPattern &getHeadPattern() const;
00084 
00088       WordPattern &getModifiableWordPattern();
00089 
00093       WordPattern &getModifiableHeadPattern();
00094 
00098       bool hasHeadPattern() const;
00099 
00103       int getMinimumLoopCount() const;
00104 
00108       int getMaximumLoopCount() const;
00109 
00113       bool hasOnlyOperator() const;
00114 
00118       bool isWildcard() const;
00119 
00123       void setMinimumLoopCount(int);
00124 
00128       void setMaximumLoopCount(int);
00129 
00133       void setOnlyOperator(bool = true);
00134 
00138       const Element *getNext() const;
00139 
00143       const Element *getPrevious() const;
00144 
00148       int getPatternPosition() const;
00149       
00150     private:
00151       const SentencePattern *d_parent;
00152       int d_listPosition;
00153 
00154       WordPattern d_wordPattern;
00155       WordPattern d_headPattern;
00156 
00157       int d_loopMin;
00158       int d_loopMax;
00159       bool d_hasOnlyOperator;
00160     };
00161 
00165     Element &createElement();
00166 
00170     typedef std::vector<const Element *> ElementList;
00171     typedef ElementList::const_iterator ElementIterator;
00172 
00176     ElementIterator elementsBegin() const;
00177 
00181     ElementIterator elementsEnd() const;
00182 
00186     const Element *getElementAtPosition(int) const;
00187 
00188   private:
00189     ElementList d_elements;
00190     bool d_hasBeginningOperator;
00191     bool d_hasEndOperator;
00192   };
00193 
00194 }
00195 
00196 #endif //_LINGUISTICDEFINITION_SENTENCEPATTERN_H_

Generated on Fri Jun 23 14:03:15 2006 for LinguisticDefinition by  doxygen 1.4.7