ec8f58f199ad217455e411bfaaf54b741af4e178
[appc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * APPC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright (C) 2017 Amdocs
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  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21  */
22
23 package org.openecomp.appc.statemachine.objects;
24
25 import java.util.ArrayList;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.concurrent.ConcurrentHashMap;
29
30
31
32 public class State{
33         private String stateName;
34         private List<Transition> transitions;
35
36         private State(){
37                 
38         }
39         
40         public State(String state){
41                 this();
42                 this.stateName = state;
43                 this.transitions = new ArrayList<Transition>();
44         }
45         
46         @Override
47         public int hashCode(){
48                 return this.stateName.hashCode();
49         }
50         
51         @Override
52         public boolean equals(Object obj){
53                 if(obj == null){
54                         return false;
55                 }
56                 if(!(obj instanceof State)){
57                         return false;
58                 }
59                 State state = (State)obj;
60                 return this.stateName.equals(state.getStateName());
61         }
62         
63
64         public String getStateName(){
65                 return stateName;
66         }
67         
68         void addTransition(Transition transition){
69                 this.transitions.add(transition);
70         }
71
72         public List<Transition> getTransitions() {
73                 return transitions;
74         }
75
76         @Override
77         public String toString(){
78                 return this.stateName;
79         }
80 }