1 /*
2  * Copyright (C) 2013, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * !!!!! DO NOT EDIT THIS FILE !!!!!
19  *
20  * This file was generated from
21  *   dictionary/structure/v4/content/probability_entry.h
22  */
23 
24 #ifndef LATINIME_BACKWARD_V402_PROBABILITY_ENTRY_H
25 #define LATINIME_BACKWARD_V402_PROBABILITY_ENTRY_H
26 
27 #include "defines.h"
28 #include "dictionary/property/historical_info.h"
29 #include "dictionary/structure/backward/v402/ver4_dict_constants.h"
30 
31 namespace latinime {
32 namespace backward {
33 namespace v402 {
34 
35 class ProbabilityEntry {
36  public:
ProbabilityEntry(const ProbabilityEntry & probabilityEntry)37     ProbabilityEntry(const ProbabilityEntry &probabilityEntry)
38             : mFlags(probabilityEntry.mFlags), mProbability(probabilityEntry.mProbability),
39               mHistoricalInfo(probabilityEntry.mHistoricalInfo) {}
40 
41     // Dummy entry
ProbabilityEntry()42     ProbabilityEntry()
43             : mFlags(0), mProbability(NOT_A_PROBABILITY), mHistoricalInfo() {}
44 
45     // Entry without historical information
ProbabilityEntry(const int flags,const int probability)46     ProbabilityEntry(const int flags, const int probability)
47             : mFlags(flags), mProbability(probability), mHistoricalInfo() {}
48 
49     // Entry with historical information.
ProbabilityEntry(const int flags,const int probability,const HistoricalInfo * const historicalInfo)50     ProbabilityEntry(const int flags, const int probability,
51             const HistoricalInfo *const historicalInfo)
52             : mFlags(flags), mProbability(probability), mHistoricalInfo(*historicalInfo) {}
53 
createEntryWithUpdatedProbability(const int probability)54     const ProbabilityEntry createEntryWithUpdatedProbability(const int probability) const {
55         return ProbabilityEntry(mFlags, probability, &mHistoricalInfo);
56     }
57 
createEntryWithUpdatedHistoricalInfo(const HistoricalInfo * const historicalInfo)58     const ProbabilityEntry createEntryWithUpdatedHistoricalInfo(
59             const HistoricalInfo *const historicalInfo) const {
60         return ProbabilityEntry(mFlags, mProbability, historicalInfo);
61     }
62 
hasHistoricalInfo()63     bool hasHistoricalInfo() const {
64         return mHistoricalInfo.isValid();
65     }
66 
getFlags()67     int getFlags() const {
68         return mFlags;
69     }
70 
getProbability()71     int getProbability() const {
72         return mProbability;
73     }
74 
getHistoricalInfo()75     const HistoricalInfo *getHistoricalInfo() const {
76         return &mHistoricalInfo;
77     }
78 
79  private:
80     // Copy constructor is public to use this class as a type of return value.
81     DISALLOW_ASSIGNMENT_OPERATOR(ProbabilityEntry);
82 
83     const int mFlags;
84     const int mProbability;
85     const HistoricalInfo mHistoricalInfo;
86 };
87 } // namespace v402
88 } // namespace backward
89 } // namespace latinime
90 #endif /* LATINIME_BACKWARD_V402_PROBABILITY_ENTRY_H */
91