f513e011cee1b8289a92446b12feef4f7f030530
[ccsdk/features.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : ccsdk features
4  * ================================================================================
5  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
6  * All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  */
22 package org.onap.ccsdk.features.sdnr.wt.common.configuration.subtypes;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27 /**
28  *
29  * @author Michael Dürre, Herbert Eiselt
30  *
31  */
32 class SectionValue {
33
34     // variables
35     private String value;
36     private final List<String> comments;
37     private boolean isUncommented;
38     // end of variables
39
40     // constructors
41     public SectionValue(String value, List<String> commentsForValue, boolean isuncommented) {
42         this.comments = commentsForValue;
43         this.value = value;
44         this.isUncommented = isuncommented;
45     }
46
47     public SectionValue(String value) {
48         this(value, new ArrayList<String>(), false);
49     }
50
51     public SectionValue(String value, boolean isUncommented) {
52         this(value, new ArrayList<String>(), isUncommented);
53     }
54     // end of constructors
55
56     // getters and setters
57     public String getValue() {
58         return value;
59     }
60
61     public SectionValue setValue(String value) {
62         this.value = value;
63         return this;
64     }
65
66     public boolean isUncommented() {
67         return isUncommented;
68     }
69
70     public SectionValue setIsUncommented(boolean isUncommented) {
71         this.isUncommented = isUncommented;
72         return this;
73     }
74
75     public void addComment(String comment) {
76         this.comments.add(comment);
77         this.isUncommented = false;
78     }
79
80     public void removeComment(String comment) {
81         this.comments.remove(comment);
82         this.isUncommented = this.comments.size()==0;
83     }
84
85     public List<String> getComments() {
86         return comments;
87     }
88     // end of getters and setters
89
90     // public methods
91     @Override
92     public String toString() {
93         return "SectionValue [value=" + value + ", comments=" + comments + ", isUncommented=" + isUncommented + "]";
94     }
95     // end of public methods
96
97
98 }