Merge "Bug 849: Fixed NPE in Translated Data Change Events."
[controller.git] / opendaylight / clustering / test / src / main / java / org / opendaylight / controller / clustering / test / internal / ComplexContainer.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.clustering.test.internal;
11
12 import java.io.Serializable;
13
14 public class ComplexContainer implements Serializable {
15     private static final long serialVersionUID = 1L;
16     private final IComplex f;
17     private final IComplex f1;
18     private final Integer state;
19
20     public ComplexContainer(String i, Integer s) {
21         this.state = s;
22         this.f = new ComplexClass(i);
23         this.f1 = new ComplexClass1(i);
24     }
25
26     public String getIdentity() {
27         if (this.f != null && this.f1 != null) {
28             return ("[" + f.whoAmI() + "]-[" + f1.whoAmI() + "]");
29         }
30         return "<NOTSET>";
31     }
32
33     public void setIdentity(String i) {
34         if (this.f != null) {
35             this.f.IAm(i);
36         }
37         if (this.f1 != null) {
38             this.f1.IAm(i);
39         }
40     }
41
42     public Integer getState() {
43         return this.state;
44     }
45
46     @Override
47     public String toString() {
48         return ("{ID:" + this.getIdentity() + ",STATE:" + this.state + "}");
49     }
50 }