Example usage for java.lang Integer compare

List of usage examples for java.lang Integer compare

Introduction

In this page you can find the example usage for java.lang Integer compare.

Prototype

public static int compare(int x, int y) 

Source Link

Document

Compares two int values numerically.

Usage

From source file:chat.viska.xmpp.Version.java

@Override
public int compareTo(Version version) {
    final int majorDiff = Integer.compare(major, version.major);
    if (majorDiff != 0) {
        return majorDiff;
    }// w  w w  . ja va 2s  .  c o m
    return Integer.compare(minor, version.minor);
}

From source file:uni.bielefeld.cmg.sparkhit.hadoop.decodec.util.HelpParam.java

/**
 * print out help info with parameters/*from  w w  w . j a v  a2s . c om*/
 */
public void printHelp() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setOptionComparator(new Comparator<Option>() {
        public int compare(Option o1, Option o2) {
            return Integer.compare(parameterMap.get(o1.getOpt()), parameterMap.get(o2.getOpt()));
        }
    });

    final String executable = System.getProperty("executable", "Hadoop jar sparkhit-hadoopDecompressor.jar");
    err.println("Name:");
    err.println("\tSparkHit hadoop decompressor");
    err.println();
    err.println("Options:");
    formatter.printOptions(new PrintWriter(err, true), 85, parameter, 2, 3); /* print formatted parameters */
    err.println();
    err.println("Usage:");
    err.println("\tDeompressing BZip2 .bz2 file in parallel using Hadoop Mapper");
    err.println(executable + " [parameters] -bz2 hdfs://master/*/fastq.bz2 -outfile hdfs://master/out_dir");
    err.println(executable + " [parameters] -gz hdfs://master/*/fastq.gz -outfile hdfs://master/out_dir");
    err.println();
}

From source file:com.quartercode.eventbridge.def.channel.DefaultChannel.java

/**
 * Creates a new default channel./*w  w w . ja  v  a  2  s  .c  o  m*/
 * 
 * @param interceptorType The type of interceptor that can be used by the channel.
 */
public DefaultChannel(Class<T> interceptorType) {

    this.interceptorType = interceptorType;

    interceptors = new TreeMap<>(new Comparator<Integer>() {

        @Override
        public int compare(Integer o1, Integer o2) {

            // Reverse the comparison in order to make the map ordering being large to small
            return Integer.compare(o2, o1);
        }

    });
}

From source file:uk.ac.cam.cl.dtg.teaching.programmingtest.java.FittedCurve.java

@Override
public int compareTo(FittedCurve o) {
    if (rsq == o.rsq) {
        return Integer.compare(System.identityHashCode(this), System.identityHashCode(o));
    } else {/*from w w w  .j  a  va  2s  . c  o  m*/
        return Double.compare(rsq, o.rsq);
    }
}

From source file:uni.bielefeld.cmg.sparkhit.util.HelpParam.java

/**
 * print out help info with parameters/*from  ww  w .  jav  a2s .com*/
 */
public void printHelp() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setOptionComparator(new Comparator<Option>() {
        public int compare(Option o1, Option o2) {
            return Integer.compare(parameterMap.get(o1.getOpt()), parameterMap.get(o2.getOpt()));
        }
    });

    final String executable = System.getProperty("executable",
            "spark-submit [spark parameter] --class uni.bielefeld.cmg.sparkhit.main.Main");
    err.println("Name:");
    err.println("\tSparkHit Main");
    err.println();
    err.println("Options:");
    formatter.printOptions(new PrintWriter(err, true), 85, parameter, 2, 3); /* print formatted parameters */
    err.println();
    err.println("Usage:");
    err.println("\tBuild reference : ");
    err.println(executable + " [parameters] -build reference.fa");
    err.println("\trun fragment recruitment : ");
    err.println(executable + " [parameters] -fastq query.fq -reference reference.fa -outfile output_file.txt");
    err.println(executable + " [parameters] -line query.txt -reference reference.fa -outfile output_file.txt");
    err.println();
}

From source file:com.github.fauu.natrank.model.DynamicRankingEntry.java

@Override
public int compareTo(DynamicRankingEntry other) {
    if (this.getRank() == 0 && other.getRank() == 0) {
        return 0;
    } else if (this.getRank() == 0 || other.getRank() == 0) {
        return -1 * Integer.compare(this.getRank(), other.getRank());
    } else {/*from  w ww .java  2s. co m*/
        return Integer.compare(this.getRank(), other.getRank());
    }
}

From source file:org.diorite.permissions.GroupEntry.java

@Override
public int compareTo(final GroupEntry o) {
    final int i = Integer.compare(o.priotity, this.priotity);
    if (i != 0) {
        return i;
    }//from  w  w  w .  ja  v a  2s .  com
    return o.getName().compareTo(this.getName());
}

From source file:cc.kave.commons.model.groum.comparator.Path.java

@Override
public int compareTo(Path other) {
    int sizeCompare = Integer.compare(path.size(), other.path.size());
    if (sizeCompare != 0) {
        return sizeCompare;
    }// w  w w.  j a va 2  s  .c  o m
    for (int i = 0; i < path.size(); i++) {
        int nodeCompare = path.get(i).compareTo(other.path.get(i));
        if (nodeCompare != 0) {
            return nodeCompare;
        }
    }
    return 0;
}

From source file:searcher.CollStat.java

@Override
public int compareTo(CollStat that) {
    return Integer.compare(sumDF, that.sumDF);
}

From source file:com.jivesoftware.os.upena.amza.shared.UpenaRingHost.java

@Override
public int compareTo(UpenaRingHost o) {
    int i = host.compareTo(o.host);
    if (i != 0) {
        return i;
    }/*from   ww w . j a va 2 s.  com*/
    return Integer.compare(port, o.port);
}