BUG-47: more subobject models
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / subobject / ExcludeRouteSubobject.java
1 /*
2  * Copyright (c) 2013 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.protocol.pcep.subobject;
9
10 public abstract class ExcludeRouteSubobject {
11
12         protected final boolean mandatory;
13
14         public ExcludeRouteSubobject(boolean mandatory) {
15                 this.mandatory = mandatory;
16         }
17
18         public boolean isMandatory() {
19                 return this.mandatory;
20         }
21
22         @Override
23         public int hashCode() {
24                 final int prime = 31;
25                 int result = 1;
26                 result = prime * result + (this.mandatory ? 1231 : 1237);
27                 return result;
28         }
29
30         @Override
31         public boolean equals(Object obj) {
32                 if (this == obj)
33                         return true;
34                 if (obj == null)
35                         return false;
36                 if (this.getClass() != obj.getClass())
37                         return false;
38                 final ExcludeRouteSubobject other = (ExcludeRouteSubobject) obj;
39                 if (this.mandatory != other.mandatory)
40                         return false;
41                 return true;
42         }
43
44 }