Code Clean Up
[bgpcep.git] / bgp / path-selection-mode / src / main / java / org / opendaylight / protocol / bgp / mode / impl / add / n / paths / AddPathBestNPathSelection.java
1 /*
2  * Copyright (c) 2016 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
9 package org.opendaylight.protocol.bgp.mode.impl.add.n.paths;
10
11 import org.opendaylight.protocol.bgp.mode.api.PathSelectionMode;
12 import org.opendaylight.protocol.bgp.mode.api.RouteEntry;
13
14 public class AddPathBestNPathSelection implements PathSelectionMode {
15     private final Long nBestPaths;
16
17     public AddPathBestNPathSelection(final Long nBestPaths) {
18         this.nBestPaths = nBestPaths;
19     }
20
21     @Override
22     public void close() throws Exception {
23         //no-op
24     }
25
26     @Override
27     public RouteEntry createRouteEntry(final boolean isComplex) {
28         if (isComplex) {
29             return new ComplexRouteEntry(this.getNBestPaths());
30         } else {
31             return new SimpleRouteEntry(this.getNBestPaths());
32         }
33     }
34
35     public Long getNBestPaths() {
36         return this.nBestPaths;
37     }
38 }