summary refs log tree commit diff stats
path: root/generator/word.h
blob: 2818202ba6be1135d8260cd5c2c15b58008d0258 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef WORD_H_91F99D46
#define WORD_H_91F99D46

#include <stdexcept>
#include <hkutil/database.h>
#include "../lib/enums.h"

namespace verbly {
  namespace generator {

    class notion;
    class lemma;
    class group;

    class word {
    public:

      // Constructors

      word(notion& n, lemma& l);

      word(notion& n, lemma& l, int tagCount);

      // Mutators

      void setAdjectivePosition(positioning adjectivePosition);

      void setVerbGroup(const group& verbGroup);

      // Accessors

      int getId() const
      {
        return id_;
      }

      notion& getNotion()
      {
        return notion_;
      }

      const notion& getNotion() const
      {
        return notion_;
      }

      lemma& getLemma()
      {
        return lemma_;
      }

      const lemma& getLemma() const
      {
        return lemma_;
      }

      bool hasTagCount() const
      {
        return hasTagCount_;
      }

      int getTagCount() const
      {
        if (!hasTagCount_)
        {
          throw std::domain_error("Word does not have a tag count");
        }

        return tagCount_;
      }

      positioning getAdjectivePosition() const
      {
        return adjectivePosition_;
      }

      bool hasVerbGroup() const
      {
        return (verbGroup_ != nullptr);
      }

      const group& getVerbGroup() const
      {
        if (!hasVerbGroup())
        {
          throw std::domain_error("Word does not have a verb group");
        }

        return *verbGroup_;
      }

    private:

      static int nextId_;

      const int id_;
      notion& notion_;
      lemma& lemma_;
      const int tagCount_ = 0;
      const bool hasTagCount_ = false;

      positioning adjectivePosition_ = positioning::undefined;
      const group* verbGroup_ = nullptr;

    };

    // Serializer

    hatkirby::database& operator<<(hatkirby::database& db, const word& arg);

  };
};

#endif /* end of include guard: WORD_H_91F99D46 */