Merge "Removed duplicate sal-binding-config dependency."
[openflowplugin.git] / applications / forwardingrules-sync / src / main / java / org / opendaylight / openflowplugin / applications / frsync / util / SyncCrudCounters.java
1 /**
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.openflowplugin.applications.frsync.util;
9
10 /**
11  * One-shot (per sync) placeholder for counts of added/updated/removed flows/groups/meters.
12  */
13 public class SyncCrudCounters {
14
15     private final CrudCounts flowCrudCounts;
16     private final CrudCounts groupCrudCounts;
17     private final CrudCounts meterCrudCounts;
18     private long startNano;
19
20     public SyncCrudCounters() {
21         flowCrudCounts = new CrudCounts();
22         groupCrudCounts = new CrudCounts();
23         meterCrudCounts = new CrudCounts();
24     }
25
26     public CrudCounts getFlowCrudCounts() {
27         return flowCrudCounts;
28     }
29
30     public CrudCounts getGroupCrudCounts() {
31         return groupCrudCounts;
32     }
33
34     public CrudCounts getMeterCrudCounts() {
35         return meterCrudCounts;
36     }
37
38
39     public long getStartNano() {
40         return startNano;
41     }
42
43     public void setStartNano(final long startNano) {
44         this.startNano = startNano;
45     }
46
47     public void resetAll() {
48         getGroupCrudCounts().setUpdated(0);
49         getGroupCrudCounts().setAdded(0);
50         getGroupCrudCounts().setRemoved(0);
51
52         getFlowCrudCounts().setUpdated(0);
53         getFlowCrudCounts().setAdded(0);
54         getFlowCrudCounts().setRemoved(0);
55
56         getMeterCrudCounts().setUpdated(0);
57         getMeterCrudCounts().setAdded(0);
58         getMeterCrudCounts().setRemoved(0);
59     }
60 }