Declare SuppressFBWarnings in imports
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / gnpy / utils / AToZComparator.java
1 /*
2  * Copyright © 2020 Orange, 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
9 package org.opendaylight.transportpce.pce.gnpy.utils;
10
11 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
12 import java.io.Serializable;
13 import java.util.Comparator;
14 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.atoz.direction.AToZ;
15
16 @SuppressWarnings("serial")
17 @SuppressFBWarnings(
18     value = "SE_NO_SERIALVERSIONID",
19     justification = "https://github.com/rzwitserloot/lombok/wiki/WHY-NOT:-serialVersionUID")
20 public class AToZComparator implements Comparator<AToZ>, Serializable {
21
22     @Override
23     public int compare(AToZ o1, AToZ o2) {
24         if (o1 == null && o2 == null) {
25             return 0;
26         } else if (o1 == null) {
27             return 1;
28         } else if (o2 == null) {
29             return -1;
30         } else if (o1.getId() == null && o2.getId() == null) {
31             return 0;
32         } else if (o1.getId() == null) {
33             return 1;
34         } else if (o2.getId() == null) {
35             return -1;
36         } else {
37             return Integer.valueOf(o1.getId()).compareTo(Integer.valueOf(o2.getId()));
38         }
39     }
40
41 }