Update all pom files in aaf inno
[aaf/inno.git] / env / src / main / java / org / onap / aaf / inno / env / Slot.java
1 /*******************************************************************************\r
2  * ============LICENSE_START====================================================\r
3  * * org.onap.aaf\r
4  * * ===========================================================================\r
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * * ===========================================================================\r
7  * * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * * you may not use this file except in compliance with the License.\r
9  * * You may obtain a copy of the License at\r
10  * * \r
11  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * * \r
13  *  * Unless required by applicable law or agreed to in writing, software\r
14  * * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * * See the License for the specific language governing permissions and\r
17  * * limitations under the License.\r
18  * * ============LICENSE_END====================================================\r
19  * *\r
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
21  * *\r
22  ******************************************************************************/\r
23 /**\r
24  * Slot.java\r
25  *\r
26  * Created on: Dec 5, 2008\r
27  * Created by:\r
28  *\r
29  * (c) 2008 SBC Knowledge Ventures, L.P. All rights reserved.\r
30  ******************************************************************* \r
31  * RESTRICTED - PROPRIETARY INFORMATION The Information contained \r
32  * herein is for use only by authorized employees of AT&T Services, \r
33  * Inc., and authorized Affiliates of AT&T Services, Inc., and is \r
34  * not for general distribution within or outside the respective \r
35  * companies. \r
36  *******************************************************************\r
37  */\r
38 package org.onap.aaf.inno.env;\r
39 \r
40 /**\r
41  * Slot's are used to store and retrieve data in the transaction's State object.\r
42  */\r
43 public final class Slot {\r
44         \r
45         /*\r
46          * The name of the Slot.\r
47          */\r
48         private final String key;\r
49         \r
50         /*\r
51          * The index of the State's local map associated with this Slot.\r
52          */\r
53         final int slot; \r
54         \r
55         /**\r
56          * Constructs a new Slot.\r
57          * \r
58          * @param index\r
59          *                      The index of State's local map this Slot is associated with.\r
60          * @param name\r
61          *                      The name of the Slot's key.\r
62          */\r
63         Slot(int index, String name) {\r
64                 slot = index;\r
65                 key = name;\r
66         }\r
67         \r
68         /**\r
69          * Debug method only to print key=slot pairs.\r
70          */\r
71         public String toString() {\r
72                 return key + '=' + slot;\r
73         }\r
74         \r
75         /**\r
76          * Returns the name of this Slot's key.\r
77          * \r
78          * @return\r
79          *                      The name of this Slot's key.\r
80          */\r
81         public String getKey() {\r
82                 return key;\r
83         }\r
84         \r
85         /**\r
86          * Put an Object into the slot on the State\r
87          * @param state\r
88          * @param obj\r
89          */\r
90         public void put(Object[] state, Object obj) {\r
91                 state[slot]=obj;\r
92         }\r
93 \r
94         /**\r
95          * Get an Object from the slot on the State\r
96          * @param state\r
97          * @param obj\r
98          */\r
99         public Object get(Object[] state) {\r
100                 return state[slot];\r
101         }\r
102 \r
103 }\r