Example usage for java.util Arrays sort

List of usage examples for java.util Arrays sort

Introduction

In this page you can find the example usage for java.util Arrays sort.

Prototype

public static void sort(Object[] a) 

Source Link

Document

Sorts the specified array of objects into ascending order, according to the Comparable natural ordering of its elements.

Usage

From source file:net.osrg.namazu.Experiment.java

public Experiment(File dir, String eqResultJsonPath, String jacocoPathRegex) throws IOException {
    this.dir = dir;
    this.resultJsonMap = new JSON().parse(new FileReader(new File(dir, eqResultJsonPath)));
    this.successful = (boolean) this.resultJsonMap.get("successful");

    this.execFileLoaders = new ArrayList<ExecFileLoader>();
    File[] jacocoFiles = FileUtils
            .listFiles(dir, new RegexFileFilter(jacocoPathRegex), DirectoryFileFilter.DIRECTORY)
            .toArray(new File[0]);
    Arrays.sort(jacocoFiles);
    for (File jacocoFile : jacocoFiles) {
        ExecFileLoader loader = new ExecFileLoader();
        // LOG.debug("Loading {}", jacocoFile);
        loader.load(jacocoFile);//  w  w w. j av a2  s .  co m
        this.execFileLoaders.add(loader);
    }

    this.pattern = new ExperimentPattern();
}

From source file:com.eugene.fithealthmaingit.FatSecretSearchAndGet.FatSecretGetMethod.java

private static String paramify(String[] params) {
    String[] p = Arrays.copyOf(params, params.length);
    Arrays.sort(p);
    return join(p, "&");
}

From source file:com.brienwheeler.lib.spring.beans.ContextBeanDumper.java

/**
 * If DEBUG logging is not enabled, do nothing.  Otherwise log an alphabetically sorted list of Spring
 * bean names contained in the context.//from ww w.  j a v a  2  s  .  com
 * 
 * @param beanFactory the beanFactory that is creating all the Spring context beans.
 */
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    ValidationUtils.assertNotNull(beanFactory, "beanFactory cannot be null");
    if (log.isDebugEnabled()) {
        StringBuffer buffer = new StringBuffer();
        String[] beanNames = beanFactory.getBeanDefinitionNames();
        Arrays.sort(beanNames);
        buffer.append("Beans present in context:");
        for (String beanName : beanNames) {
            buffer.append("\n        ");
            buffer.append(beanName);
        }
        log.debug(buffer.toString());
    }
}

From source file:fr.duminy.jbackup.core.archive.FileCollectorTest.java

@Before
public void setUp() throws IOException {
    directory = tempFolder.newFolder().toPath();

    expectedFiles = new Path[FILES.length];
    int i = 0;/*from   w  ww  .  j  a v a 2s.  co  m*/
    for (String file : FILES) {
        expectedFiles[i++] = createFile(file);
    }
    Arrays.sort(expectedFiles);
}

From source file:mojo.view.util.DebugUtils.java

public static void logBeanNames(ApplicationContext ctx) {
    System.out.println(ctx.getClass().getName() + " bean names:");
    String[] beanNames = ctx.getBeanDefinitionNames();
    Arrays.sort(beanNames);

    for (String beanName : beanNames) {
        System.out.println("\t" + beanName);
    }/*w  w w.jav a2s . c  om*/
}

From source file:cn.edu.pku.cbi.mosaichunter.filter.MappingQualityFilter.java

@Override
public boolean doFilter(Site site) {
    double[] majorAlleleQualities = new double[site.getMajorAlleleCount()];
    double[] minorAlleleQualities = new double[site.getMinorAlleleCount()];
    int i1 = 0;//from ww  w.  ja  va2s . c o  m
    int i2 = 0;
    for (int i = 0; i < site.getDepth(); ++i) {
        if (site.getBases()[i] == site.getMajorAllele()) {
            majorAlleleQualities[i1] = site.getReads()[i].getMappingQuality();
            i1++;
        } else if (site.getBases()[i] == site.getMinorAllele()) {
            minorAlleleQualities[i2] = site.getReads()[i].getMappingQuality();
            i2++;
        }
    }
    Arrays.sort(majorAlleleQualities);
    Arrays.sort(minorAlleleQualities);

    StringBuilder majorQualities = new StringBuilder();
    StringBuilder minorQualities = new StringBuilder();

    for (int i = 0; i < majorAlleleQualities.length; ++i) {
        majorQualities.append(i > 0 ? "," : "").append((int) majorAlleleQualities[i]);
    }
    for (int i = 0; i < minorAlleleQualities.length; ++i) {
        minorQualities.append(i > 0 ? "," : "").append((int) minorAlleleQualities[i]);
    }

    double p = WilcoxonRankSumTest.twoSided(majorAlleleQualities, minorAlleleQualities);
    site.setMetadata(getName(), new Object[] { majorQualities, minorQualities, p });
    return p >= pValueCutoff;
}

From source file:org.jimsey.projects.turbine.condenser.Application.java

@SuppressWarnings("unused")
private static void logBeanNames(final ConfigurableApplicationContext spring) {
    logger.info("Let's inspect the beans provided by Spring Boot:");
    String[] beanNames = spring.getBeanDefinitionNames();
    Arrays.sort(beanNames);
    for (String beanName : beanNames) {
        System.out.println(beanName);
    }//  w  w  w . ja va 2s .co  m
}

From source file:org.jblogcms.core.common.service.ItemServiceToolImpl.java

@Override
public List<I> addItemRelationsToItemList(List<I> items, Long accountId) {
    if (items != null && !items.isEmpty() && accountId != null) {
        List<IREL> itemRelations = itemRelationRepository.getItemRelations(items, accountId);

        if (!itemRelations.isEmpty()) {
            long[] sortedItemRelations = new long[itemRelations.size()];
            int i = 0;
            for (ItemRelation itemRelation : itemRelations) {
                sortedItemRelations[i++] = itemRelation.getItem().getId();
            }//from  w w  w .j a  va  2s .co m
            Arrays.sort(sortedItemRelations);

            for (I item : items) {
                int k = Arrays.binarySearch(sortedItemRelations, item.getId());
                if (k >= 0) {
                    item.setCurrentItemRelation(itemRelations.get(k));
                }
            }
        }
    }
    return items;
}

From source file:edu.arizona.cs.hadoop.fs.irods.output.HirodsMapFileOutputFormat.java

/**
 * Open the output generated by this format.
 *//*from  w  ww.j  a  v  a2s  .  c om*/
public static MapFile.Reader[] getReaders(Path dir, Configuration conf) throws IOException {
    FileSystem fs = dir.getFileSystem(conf);
    Path[] names = FileUtil.stat2Paths(fs.listStatus(dir));

    // sort names, so that hash partitioning works
    Arrays.sort(names);

    MapFile.Reader[] parts = new MapFile.Reader[names.length];
    for (int i = 0; i < names.length; i++) {
        parts[i] = new MapFile.Reader(fs, names[i].toString(), conf);
    }
    return parts;
}

From source file:com.opengamma.financial.analytics.timeseries.YieldCurveHistoricalTimeSeriesFunction.java

/**
 * @param excludedCurves The excluded curve names, not null
 *//*from w w w .ja va  2s  .  c o  m*/
public YieldCurveHistoricalTimeSeriesFunction(final String[] excludedCurves) {
    ArgumentChecker.notNull(excludedCurves, "excluded curves");
    _excludedCurves = excludedCurves;
    Arrays.sort(_excludedCurves);
}