Merge "Attach sources and javadoc only with -DrepoBuild"
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPObjectComparator.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.bgp.rib.impl;
9
10 import java.util.Comparator;
11
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.PathAttributes;
13
14 /**
15  * This comparator is intended to implement BGP Best Path Selection algorithm, as described at
16  * 
17  * @see http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094431.shtml
18  * 
19  * @param <T> Actual object state reference
20  */
21 final class BGPObjectComparator implements Comparator<PathAttributes> {
22         public static final BGPObjectComparator INSTANCE = new BGPObjectComparator();
23
24         private BGPObjectComparator() {
25         }
26
27         @Override
28         public int compare(final PathAttributes o1, final PathAttributes o2) {
29                 if (o1 == null) {
30                         return 1;
31                 }
32                 if (o2 == null) {
33                         return -1;
34                 }
35                 if (o1.equals(o2)) {
36                         return 0;
37                 }
38
39                 // FIXME: BUG-185: implement here
40
41                 return 0;
42         }
43 }