Sync Common folder
[transportpce.git] / common / src / main / java / org / opendaylight / transportpce / common / fixedflex / FixedFlexImpl.java
1 /*
2  * Copyright © 2017 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.common.fixedflex;
10
11 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory;
13
14 public final class FixedFlexImpl implements FixedFlexInterface {
15     private static final Logger LOG = LoggerFactory.getLogger(FixedFlexImpl.class);
16     private long index;
17     private double centerFrequency;
18     private double start;
19     private double stop;
20     private double wavelength;
21
22     public FixedFlexImpl(Long index, double centreFrequency, double start, double stop, double wavelength) {
23         this.index = index;
24         this.centerFrequency = centreFrequency;
25         this.start = start;
26         this.stop = stop;
27         this.wavelength = wavelength;
28     }
29
30     public FixedFlexImpl() {
31         this.index = 0L;
32         this.centerFrequency = 0;
33         this.start = 0;
34         this.stop = 0;
35         this.wavelength = 0;
36     }
37
38     @Override
39     /**
40      * @param index Wavelength number
41      * @return Returns FixedFlexImp object with the calculated result.
42      **/
43     public FixedFlexImpl getFixedFlexWaveMapping(long wlIndex) {
44         FixedFlexImpl fixedFlex = new FixedFlexImpl();
45         fixedFlex.centerFrequency = 196.1 - (wlIndex - 1) * 0.05;
46         fixedFlex.wavelength = 1528.77 + ((wlIndex - 1) * 0.39);
47         fixedFlex.start = fixedFlex.centerFrequency - 0.025;
48         fixedFlex.stop = fixedFlex.centerFrequency + 0.025;
49         return fixedFlex;
50     }
51
52     public double getCenterFrequency() {
53         return centerFrequency;
54     }
55
56     public double getStart() {
57         return start;
58     }
59
60     public long getIndex() {
61         return index;
62     }
63
64     public double getStop() {
65         return stop;
66     }
67
68     public double getWavelength() {
69         return wavelength;
70     }
71 }