Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Yuta HIGUCHI
2014-11-04 10:24:26 -0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4e34886d414fb4336c795ae16e35ebd5b55a07a8
4e34886d
1 parent
c5ea9504
Add copy constructor
Change-Id: If9b50a8e5db29e4bae2c93b51f34c5e043563094
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
core/store/dist/src/main/java/org/onlab/onos/store/mastership/impl/RoleValue.java
core/store/dist/src/main/java/org/onlab/onos/store/mastership/impl/RoleValue.java
View file @
4e34886
...
...
@@ -31,6 +31,7 @@ import org.onlab.onos.net.MastershipRole;
import
com.google.common.base.MoreObjects
;
import
com.google.common.base.MoreObjects.ToStringHelper
;
import
com.google.common.collect.Lists
;
/**
* A structure that holds node mastership roles associated with a
...
...
@@ -40,12 +41,26 @@ final class RoleValue {
protected
final
Map
<
MastershipRole
,
List
<
NodeId
>>
value
=
new
EnumMap
<>(
MastershipRole
.
class
);
/**
* Constructs empty RoleValue.
*/
public
RoleValue
()
{
value
.
put
(
MastershipRole
.
MASTER
,
new
LinkedList
<
NodeId
>());
value
.
put
(
MastershipRole
.
STANDBY
,
new
LinkedList
<
NodeId
>());
value
.
put
(
MastershipRole
.
NONE
,
new
LinkedList
<
NodeId
>());
}
/**
* Constructs copy of specified RoleValue.
*
* @param original original to create copy from
*/
public
RoleValue
(
final
RoleValue
original
)
{
value
.
put
(
MASTER
,
Lists
.
newLinkedList
(
original
.
value
.
get
(
MASTER
)));
value
.
put
(
STANDBY
,
Lists
.
newLinkedList
(
original
.
value
.
get
(
STANDBY
)));
value
.
put
(
NONE
,
Lists
.
newLinkedList
(
original
.
value
.
get
(
NONE
)));
}
// exposing internals for serialization purpose only
Map
<
MastershipRole
,
List
<
NodeId
>>
value
()
{
return
Collections
.
unmodifiableMap
(
value
);
...
...
Please
register
or
login
to post a comment