blob: 294d7d7d187a0f11186cffc4264a6c1a923ae9aa [file] [log] [blame]
Aihua Guo1ce2dd12016-08-12 23:37:44 -04001/*
2 * Copyright 2016 Open Networking Laboratory
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.tetopology.management.api;
17
18
19import com.google.common.base.MoreObjects;
20import com.google.common.base.Objects;
21
22/**
23 * Internal TE Network implementation.
24 */
25public class InternalTeNetwork extends DefaultNetwork {
26 private TeTopologyType teTopologyType;
27
28 /**
29 * Constructor with all fields.
30 *
31 * @param teTopologyType TE topology type
32 * @param network network object
33 */
34 public InternalTeNetwork(TeTopologyType teTopologyType, Network network) {
35 super(network);
36 this.teTopologyType = teTopologyType;
37 }
38
39 /**
40 * Returns the TE topoology type.
41 *
42 * @return TE topology type
43 */
44 public TeTopologyType getTeTopologyType() {
45 return this.teTopologyType;
46 }
47
48 @Override
49 public int hashCode() {
50 return Objects.hashCode(super.hashCode(), teTopologyType);
51 }
52
53 @Override
54 public boolean equals(Object object) {
55 if (this == object) {
56 return true;
57 }
58 if (object instanceof InternalTeNetwork) {
59
60 if (!super.equals(object)) {
61 return false;
62 }
63
64 InternalTeNetwork that = (InternalTeNetwork) object;
65 return Objects.equal(this.teTopologyType, that.teTopologyType);
66 }
67 return false;
68 }
69
70 @Override
71 public String toString() {
72 return MoreObjects.toStringHelper(this)
73 .add("teTopologyType", teTopologyType)
74 .add("DefaultNetwork", super.toString())
75 .toString();
76 }
77
78}