Update License text
[vnfsdk/compliance.git] / veslibrary / ves_javalibrary / evel_javalib2 / src / evel_javalibrary / att / com / EvelOptionDouble.java
1 package evel_javalibrary.att.com;\r
2 /**************************************************************************//**\r
3  * @file\r
4  * Evel Option Double class\r
5  *\r
6  * This file implements the Evel Option class to handle optional double fields.\r
7  *\r
8  * License\r
9  * -------\r
10  * Unless otherwise specified, all software contained herein is\r
11  * Licensed under the Apache License, Version 2.0 (the "License");\r
12  * you may not use this file except in compliance with the License.\r
13  * You may obtain a copy of the License at\r
14  *        http://www.apache.org/licenses/LICENSE-2.0\r
15  *\r
16  * Unless required by applicable law or agreed to in writing, software\r
17  * distributed under the License is distributed on an "AS IS" BASIS,\r
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
19  * See the License for the specific language governing permissions and\r
20  * limitations under the License.\r
21  *****************************************************************************/\r
22 \r
23 import javax.json.JsonObjectBuilder;\r
24 \r
25 import org.apache.log4j.Logger;\r
26 /*\r
27  * Handles Optional Double fields\r
28  */\r
29 public class EvelOptionDouble extends EvelOption {\r
30 \r
31         /**************************************************************************//**\r
32          * Optional parameter holder for string.\r
33          *****************************************************************************/\r
34      Double value;\r
35      \r
36      private static final Logger LOGGER = Logger.getLogger( EvelOptionDouble.class.getName() );\r
37      \r
38          public EvelOptionDouble()\r
39          {\r
40                  super(false);\r
41                  value = 0.0;\r
42          }\r
43          \r
44          public EvelOptionDouble(boolean val, Double str)\r
45          {\r
46                  super(val);\r
47                  value = str;\r
48          }\r
49          \r
50          public void InitValue()\r
51          {\r
52                  is_set = false;\r
53                  value = 0.0;\r
54          }\r
55          //Sets Double value\r
56          public void SetValue(Double str)\r
57          {\r
58                  is_set = true;\r
59                  value = str;\r
60          }\r
61          //Sets Double value with debugging message\r
62          public void SetValuePr(Double str, String mstr)\r
63          {\r
64                  \r
65                  is_set = true;\r
66                  value = str;   \r
67                  LOGGER.debug("Setting "+mstr+" to "+str);\r
68          }\r
69          //Getter\r
70          public Double GetValue()\r
71          {\r
72                  return value;\r
73          }\r
74          /*\r
75           * Encoding JSON function\r
76           * @retval boolean returns option true if object is encoded\r
77           */\r
78          public boolean encJsonValue(JsonObjectBuilder obj, String name)\r
79          {\r
80                  //If option is set encodes Double value into JSON object\r
81                  // with name tag\r
82                  if( is_set ) obj.add(name, value);\r
83                  return is_set;\r
84          }\r
85 \r
86 }\r
87 \r