X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=common%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fcommon%2Ffixedflex%2FFixedFlexImpl.java;fp=common%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fcommon%2Ffixedflex%2FFixedFlexImpl.java;h=dd5bd03b663184447ae7c1da733e400a69c0cb8c;hb=b61c699f055fdf780aaf0b4b0d1fc82074099f96;hp=0000000000000000000000000000000000000000;hpb=abbca95c8944ec742d71bd87d2363c9c00c41844;p=transportpce.git diff --git a/common/src/main/java/org/opendaylight/transportpce/common/fixedflex/FixedFlexImpl.java b/common/src/main/java/org/opendaylight/transportpce/common/fixedflex/FixedFlexImpl.java new file mode 100644 index 000000000..dd5bd03b6 --- /dev/null +++ b/common/src/main/java/org/opendaylight/transportpce/common/fixedflex/FixedFlexImpl.java @@ -0,0 +1,71 @@ +/* + * Copyright © 2017 Orange, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.transportpce.common.fixedflex; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public final class FixedFlexImpl implements FixedFlexInterface { + private static final Logger LOG = LoggerFactory.getLogger(FixedFlexImpl.class); + private long index; + private double centerFrequency; + private double start; + private double stop; + private double wavelength; + + public FixedFlexImpl(Long index, double centreFrequency, double start, double stop, double wavelength) { + this.index = index; + this.centerFrequency = centreFrequency; + this.start = start; + this.stop = stop; + this.wavelength = wavelength; + } + + public FixedFlexImpl() { + this.index = 0L; + this.centerFrequency = 0; + this.start = 0; + this.stop = 0; + this.wavelength = 0; + } + + @Override + /** + * @param index Wavelength number + * @return Returns FixedFlexImp object with the calculated result. + **/ + public FixedFlexImpl getFixedFlexWaveMapping(long wlIndex) { + FixedFlexImpl fixedFlex = new FixedFlexImpl(); + fixedFlex.centerFrequency = 196.1 - (wlIndex - 1) * 0.05; + fixedFlex.wavelength = 1528.77 + ((wlIndex - 1) * 0.39); + fixedFlex.start = fixedFlex.centerFrequency - 0.025; + fixedFlex.stop = fixedFlex.centerFrequency + 0.025; + return fixedFlex; + } + + public double getCenterFrequency() { + return centerFrequency; + } + + public double getStart() { + return start; + } + + public long getIndex() { + return index; + } + + public double getStop() { + return stop; + } + + public double getWavelength() { + return wavelength; + } +}