• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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 #include "annotator/datetime/testing/datetime-component-builder.h"
18 
19 namespace libtextclassifier3 {
20 
Add(DatetimeComponent::ComponentType type,int value)21 DatetimeComponentsBuilder DatetimeComponentsBuilder::Add(
22     DatetimeComponent::ComponentType type, int value) {
23   DatetimeComponent component;
24   component.component_type = type;
25   component.value = value;
26   return AddComponent(component);
27 }
28 
Add(DatetimeComponent::ComponentType type,int value,DatetimeComponent::RelativeQualifier relative_qualifier,int relative_count)29 DatetimeComponentsBuilder DatetimeComponentsBuilder::Add(
30     DatetimeComponent::ComponentType type, int value,
31     DatetimeComponent::RelativeQualifier relative_qualifier,
32     int relative_count) {
33   DatetimeComponent component;
34   component.component_type = type;
35   component.value = value;
36   component.relative_qualifier = relative_qualifier;
37   component.relative_count = relative_count;
38   return AddComponent(component);
39 }
40 
Build()41 std::vector<DatetimeComponent> DatetimeComponentsBuilder::Build() {
42   return std::move(datetime_components_);
43 }
44 
AddComponent(const DatetimeComponent & datetime_component)45 DatetimeComponentsBuilder DatetimeComponentsBuilder::AddComponent(
46     const DatetimeComponent& datetime_component) {
47   datetime_components_.push_back(datetime_component);
48   return *this;
49 }
50 }  // namespace libtextclassifier3
51