Java Integer Mod modulateCircularIndex(int index, int seqLength)

Here you can find the source of modulateCircularIndex(int index, int seqLength)

Description

Takes a point on a circular location and moves it left until it falls at the earliest possible point that represents the same base.

License

GNU General Public License

Parameter

Parameter Description
index Index of the position to work with
seqLength Length of the Sequence

Return

The shifted point

Declaration

public static int modulateCircularIndex(int index, int seqLength) 

Method Source Code

//package com.java2s;
/*//w w w  .  j  a va2 s  .c  om
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 * Created on 01-21-2010
 */

public class Main {
    /**
     * Takes a point on a circular location and moves it left until it falls
     * at the earliest possible point that represents the same base.
     *
     * @param index Index of the position to work with
     * @param seqLength Length of the Sequence
     * @return The shifted point
     */
    public static int modulateCircularIndex(int index, int seqLength) {
        // Dummy case
        if (seqLength == 0) {
            return index;
        }
        // Modulate
        while (index > seqLength) {
            index -= seqLength;
        }
        return index;
    }
}

Related

  1. modPos(int divisor, int dividend)
  2. modSubtract(long a, long b, int m)
  3. modularExp(long base, long exp, int modulus)
  4. modularInverses(int p)
  5. modularInvert(int num, int modulus)
  6. modulo(int a, int b)
  7. modulo(int a, int b)
  8. modulo(int dividend, int divisor)
  9. modulo(int x, int m)