1 package org.state4j.sm;
2 import org.state4j.exceptions.PreconditionViolatedException;
3
4
5 public class SmEventImpl implements SmEvent {
6 private String name;
7 private SmEventOriginator originator;
8
9 public SmEventImpl(SmEventOriginator orig) {
10 this.originator = orig;
11 }
12
13 public String getName() {
14 return name;
15 }
16
17 public void setName(String name) {
18 this.name = name;
19 }
20 public boolean hasName() {
21 return this.name != null;
22 }
23
24 public boolean hasOriginator() {
25 return this.originator != null;
26 }
27
28 public SmEventOriginator getOriginator() {
29 if(!this.hasOriginator()) {
30 throw new PreconditionViolatedException("Sorry!! cannot get originator");
31 }
32 return originator;
33 }
34
35
36 }