blob: 7263134c5b777fa44f1d1ad15393caa50e410675 [file] [log] [blame]
Sean Condon0e89bda2017-03-21 14:23:19 +00001/*
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 */
16package org.onosproject.incubator.net.l2monitoring.soam.delay;
17
18import java.time.Duration;
19import java.time.Instant;
20
21/**
22 * The default implementation of DelayMeasurementStatCurrent.
23 * {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatCurrent}.
24 */
25public final class DefaultDelayMeasurementStatCurrent
26 extends DefaultDelayMeasurementStat
27 implements DelayMeasurementStatCurrent {
28
29 private final Instant startTime;
30
31 protected DefaultDelayMeasurementStatCurrent(DefaultDmStatCurrentBuilder builder) {
32 super(builder);
33 this.startTime = builder.startTime;
34 }
35
36 @Override
37 public Instant startTime() {
38 return startTime;
39 }
40
41 public static DmStatCurrentBuilder builder(Duration elapsedTime, boolean suspectStatus) {
42 return new DefaultDmStatCurrentBuilder(elapsedTime, suspectStatus);
43 }
44
45 /**
46 * Builder for {@link org.onosproject.incubator.net.l2monitoring.soam.delay.DelayMeasurementStatCurrent}.
47 */
48 private static final class DefaultDmStatCurrentBuilder extends DefaultDmStatBuilder
49 implements DmStatCurrentBuilder {
50
51 private Instant startTime;
52
53 private DefaultDmStatCurrentBuilder(Duration elapsedTime, boolean suspectStatus) {
54 super(elapsedTime, suspectStatus);
55 }
56
57 @Override
58 public DmStatCurrentBuilder startTime(Instant startTime) {
59 this.startTime = startTime;
60 return this;
61 }
62
63 @Override
64 public DelayMeasurementStat build() {
65 return new DefaultDelayMeasurementStatCurrent(this);
66 }
67 }
68}