2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Copyright (C) 2017 Amdocs
\r
8 * =============================================================================
\r
9 * Licensed under the Apache License, Version 2.0 (the "License");
\r
10 * you may not use this file except in compliance with the License.
\r
11 * You may obtain a copy of the License at
\r
13 * http://www.apache.org/licenses/LICENSE-2.0
\r
15 * Unless required by applicable law or agreed to in writing, software
\r
16 * distributed under the License is distributed on an "AS IS" BASIS,
\r
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
18 * See the License for the specific language governing permissions and
\r
19 * limitations under the License.
\r
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
\r
25 package org.openecomp.appc.statemachine.objects;
\r
27 import java.util.HashSet;
\r
28 import java.util.Set;
\r
30 public class StateMachineMetadata {
\r
32 private Set<State> states;
\r
33 private Set<Event> events;
\r
35 private StateMachineMetadata(StateMachineMetadataBuilder builder){
\r
36 states = builder.states;
\r
37 events = builder.events;
\r
40 public Set<State> getStates() {
\r
44 public Set<Event> getEvents() {
\r
48 public static class StateMachineMetadataBuilder{
\r
50 private Set<State> states;
\r
51 private Set<Event> events;
\r
53 public StateMachineMetadataBuilder(){
\r
54 states = new HashSet<>();
\r
55 events = new HashSet<>();
\r
58 public StateMachineMetadataBuilder addState(State state){
\r
59 this.states.add(state);
\r
63 public StateMachineMetadataBuilder addEvent(Event event){
\r
64 this.events.add(event);
\r
68 public StateMachineMetadataBuilder addTransition(State currentState,Event event,State nextState){
\r
69 Transition transition = new Transition(event,nextState);
\r
70 currentState.addTransition(transition);
\r
74 public StateMachineMetadata build(){
\r
75 return new StateMachineMetadata(this);
\r