Toshio Koide | b8cea26 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.flowmanager; |
| 2 | |
| 3 | import static com.google.common.base.Preconditions.checkNotNull; |
| 4 | |
| 5 | import java.util.Set; |
| 6 | |
| 7 | import com.google.common.collect.ImmutableSet; |
| 8 | |
| 9 | /** |
| 10 | * The event class which notifies the set of the flow state transitions. |
| 11 | */ |
| 12 | public class FlowStatesChangedEvent { |
| 13 | private final long time; |
| 14 | private final Set<FlowStateChange> changes; |
| 15 | |
| 16 | /** |
| 17 | * Creates the {@link FlowStatesChangedEvent} instance. |
| 18 | * |
| 19 | * @param time the time at which the event was created in milliseconds since start of epoch |
| 20 | * @param changes the set of {@link FlowStateChange} objects |
| 21 | */ |
Toshio Koide | d6dbb95 | 2014-08-22 14:29:04 -0700 | [diff] [blame] | 22 | public FlowStatesChangedEvent(long time, Set<FlowStateChange> changes) { |
Toshio Koide | b8cea26 | 2014-08-12 18:45:46 -0700 | [diff] [blame] | 23 | this.time = time; |
| 24 | this.changes = ImmutableSet.copyOf(checkNotNull(changes)); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Gets the time at which the event was created. |
| 29 | * |
| 30 | * @return the time at which the event was created in milliseconds since start of epoch |
| 31 | */ |
| 32 | public long getTime() { |
| 33 | return time; |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Gets the set of state changes happened at once. |
| 38 | * |
| 39 | * @return the set of {@link FlowStateChange} objects |
| 40 | */ |
| 41 | public Set<FlowStateChange> getStateChanges() { |
| 42 | return changes; |
| 43 | } |
| 44 | } |