bf15c3ebfd46e5b6b43abd01b61100b08b166186
[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.protocol.bgp.parser.AbstractBGPObjectState;
13
14
15 /**
16  * This comparator is intended to implement BGP Best Path Selection algorithm, as described at
17  * 
18  * @see http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094431.shtml
19  * 
20  * @param <T> Actual object state reference
21  */
22 final class BGPObjectComparator<T extends AbstractBGPObjectState<?>> implements Comparator<T> {
23         @Override
24         public int compare(final T o1, final T o2) {
25                 if (o1 == o2)
26                         return 0;
27                 if (o1 == null)
28                         return 1;
29                 if (o2 == null)
30                         return -1;
31
32                 // FIXME: look at ASPath
33                 // FIXME: look at everything else :-)
34
35                 return 0;
36         }
37 }