Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.incubator.net.l2monitoring.soam; |
| 17 | |
| 18 | import java.time.Duration; |
| 19 | import java.time.Instant; |
| 20 | |
| 21 | /** |
| 22 | * A base class with common attributes of StartTime and StopTime. |
| 23 | */ |
| 24 | public abstract class SoamTime { |
| 25 | protected final TimeOption option; |
| 26 | protected final Duration relativeTime; |
| 27 | protected final Instant absoluteTime; |
| 28 | |
| 29 | public TimeOption option() { |
| 30 | return option; |
| 31 | } |
| 32 | |
| 33 | public Duration relativeTime() { |
| 34 | return relativeTime; |
| 35 | } |
| 36 | |
| 37 | public Instant absoluteTime() { |
| 38 | return absoluteTime; |
| 39 | } |
| 40 | |
| 41 | protected SoamTime(TimeOption option, Duration relativeStart, Instant absoluteStart) { |
| 42 | this.option = option; |
| 43 | this.relativeTime = relativeStart; |
| 44 | this.absoluteTime = absoluteStart; |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Abstract interface for TimeOptions on SoamTime concrete classes. |
| 49 | */ |
| 50 | public interface TimeOption { |
| 51 | } |
| 52 | } |