mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-26 05:41:08 +01:00
Eliminate code duplication in initialization
Change-Id: I067f2e0bb22bc24c3e3ac6ba24920c7ceebeee1e
This commit is contained in:
parent
ab8b0c075e
commit
69f03171e9
@ -36,6 +36,20 @@ public class DefaultGroup extends DefaultGroupDescription
|
|||||||
private long referenceCount;
|
private long referenceCount;
|
||||||
private GroupId id;
|
private GroupId id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes default values.
|
||||||
|
*
|
||||||
|
* @param newId group id for new group
|
||||||
|
*/
|
||||||
|
private void initialize(GroupId newId) {
|
||||||
|
id = newId;
|
||||||
|
state = GroupState.PENDING_ADD;
|
||||||
|
life = 0;
|
||||||
|
packets = 0;
|
||||||
|
bytes = 0;
|
||||||
|
referenceCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default group object constructor with the parameters.
|
* Default group object constructor with the parameters.
|
||||||
*
|
*
|
||||||
@ -44,12 +58,7 @@ public class DefaultGroup extends DefaultGroupDescription
|
|||||||
*/
|
*/
|
||||||
public DefaultGroup(GroupId id, GroupDescription groupDesc) {
|
public DefaultGroup(GroupId id, GroupDescription groupDesc) {
|
||||||
super(groupDesc);
|
super(groupDesc);
|
||||||
this.id = id;
|
initialize(id);
|
||||||
this.state = GroupState.PENDING_ADD;
|
|
||||||
this.life = 0;
|
|
||||||
this.packets = 0;
|
|
||||||
this.bytes = 0;
|
|
||||||
this.referenceCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,12 +75,7 @@ public class DefaultGroup extends DefaultGroupDescription
|
|||||||
GroupDescription.Type type,
|
GroupDescription.Type type,
|
||||||
GroupBuckets buckets) {
|
GroupBuckets buckets) {
|
||||||
super(deviceId, type, buckets);
|
super(deviceId, type, buckets);
|
||||||
this.id = id;
|
initialize(id);
|
||||||
this.state = GroupState.PENDING_ADD;
|
|
||||||
this.life = 0;
|
|
||||||
this.packets = 0;
|
|
||||||
this.bytes = 0;
|
|
||||||
this.referenceCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user