summary refs log tree commit diff stats
path: root/generator/word.h
blob: a994ec3e036734566b60edecded7fb1c4deac090 (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
#ifndef WORD_H_91F99D46
#define WORD_H_91F99D46

#include <cassert>
#include "../lib/enums.h"

namespace verbly {
  namespace generator {

    class notion;
    class lemma;
    class database;
    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
      {
        // Calling code should always call hasTagCount first.
        assert(hasTagCount_);

        return tagCount_;
      }

      positioning getAdjectivePosition() const
      {
        return adjectivePosition_;
      }

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

      const group& getVerbGroup() const
      {
        // Calling code should always call hasVerbGroup first.
        assert(verbGroup_ != nullptr);

        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

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

  };
};

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