Example usage for org.apache.commons.lang ArrayUtils addAll

List of usage examples for org.apache.commons.lang ArrayUtils addAll

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils addAll.

Prototype

public static double[] addAll(double[] array1, double[] array2) 

Source Link

Document

Adds all the elements of the given arrays into a new array.

Usage

From source file:io.cloudslang.engine.partitions.services.PartitionTemplateImpl.java

public void setCallbackClass(Class<? extends PartitionCallback> callbackClass) {
    logger.info("Registering callback class " + callbackClass.getSimpleName() + " for partition group ["
            + groupName + "]");
    Map<String, ? extends PartitionCallback> callbacksMap = applicationContext.getBeansOfType(callbackClass);

    if (!callbacksMap.isEmpty()) {
        if (logger.isDebugEnabled())
            logger.debug("Partition group [" + groupName + "] callbacks found: " + callbacksMap.keySet());
        PartitionCallback[] callbacksByClass = callbacksMap.values()
                .toArray(new PartitionCallback[callbacksMap.size()]);
        callbacks = (PartitionCallback[]) ArrayUtils.addAll(callbacks, callbacksByClass);
    } else {//from  ww  w  .ja v a2 s  .  com
        logger.warn("Partition group [" + groupName + "]: no callbacks found by class " + callbackClass);
    }
}

From source file:com.nwmogk.bukkit.loans.object.ImmutableOffer.java

public String[] toString(SerenityLoans plugin)
        throws InterruptedException, ExecutionException, TimeoutException {

    EconomyManager econ = plugin.getEcon();

    String[] result = { String.format("    Lender: %s", plugin.playerManager.entityNameLookup(lender)),
            String.format("    Borrower: %s", plugin.playerManager.entityNameLookup(borrower)),
            String.format("    Loan value: %s", econ.format(value)),
            String.format("    Interest rate: %s (%s)", econ.formatPercent(interestRate),
                    Conf.getIntReportingString()),
            String.format("    Minimum payment: %s", econ.format(minPayment)),
            String.format("    Term: %s", Conf.buildTimeString(term)),
            String.format("    Compounding period: %s", Conf.buildTimeString(compoundingPeriod)),
            String.format("    Payment time: %s", Conf.buildTimeString(paymentTime)),
            String.format("    Payment frequency: %s", Conf.buildTimeString(paymentFrequency)),
            String.format("    Loan type: %s", loanType) };

    String[] lateFeeRelated = { String.format("    Late fee: %s", econ.format(lateFee)),
            String.format("    Grace period: %s", Conf.buildTimeString(gracePeriod)) };

    String[] serviceFeeRelated = { String.format("    Service fee: %s", econ.format(serviceFee)),
            String.format("    Service fee frequency: %s", Conf.buildTimeString(serviceFeeFrequency)) };

    if (lateFee != 0)
        result = (String[]) ArrayUtils.addAll(result, lateFeeRelated);
    if (serviceFee != 0)
        result = (String[]) ArrayUtils.addAll(result, serviceFeeRelated);

    return result;
}

From source file:mitm.common.security.ca.CSVRequestConverterTest.java

@Test
public void testUnicodeBOM() throws Exception {
    String input = "e, cn\r\ntest1@example.com,";

    CSVRequestConverter converter = new CSVRequestConverter();

    byte[] bom = new byte[] { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF };

    byte[] withBOM = ArrayUtils.addAll(bom, input.getBytes(CharacterEncoding.UTF_8));

    List<RequestParameters> parameters = converter.convertCSV(new ByteArrayInputStream(withBOM));

    assertNotNull(parameters);/*from w ww .ja  v  a 2s  .c  om*/
    assertEquals(1, parameters.size());

    RequestParameters request = parameters.get(0);

    assertEquals("EMAILADDRESS=test1@example.com, CN=", request.getSubject().toString());
}

From source file:com.wavemaker.tools.ant.NewCopyRuntimeJarsTask.java

@Override
public void execute() {
    if (this.todir == null) {
        throw new IllegalArgumentException("todir is not set");
    }/*from w  ww  .j a v a2s  . c o  m*/
    if (this.from == null) {
        throw new IllegalArgumentException("from is not set");
    }
    if (!this.todir.exists()) {
        throw new IllegalArgumentException(this.todir + " does not exist");
    }
    if (!this.from.exists()) {
        throw new IllegalArgumentException(this.from + " does not exist");
    }

    File runtimeJarFile = getRuntimeJarFile();

    List<String> runtimeJarNames = getReferencedClassPathJars(runtimeJarFile, true);
    String[] runtimeJarNamesArr = runtimeJarNames.toArray(new String[runtimeJarNames.size()]);

    Resources<com.wavemaker.tools.io.File> projectJars = getProjectJarFileSet();
    List<com.wavemaker.tools.io.File> projJarList = projectJars.fetchAll();
    String[] proJarNamesArr = null;
    if (projJarList != null && projJarList.size() > 0) {
        proJarNamesArr = new String[projJarList.size()];
        int i = 0;
        for (com.wavemaker.tools.io.File projJar : projJarList) {
            proJarNamesArr[i] = projJar.getName();
            i++;
        }
    }

    // Delete all jars not included in these lists

    ResourceFilter included = FilterOn.antPattern("*.jar");

    ResourceFilter excluded = FilterOn.caseSensitiveNames()
            .matching((String[]) ArrayUtils.addAll(runtimeJarNamesArr, proJarNamesArr));

    this.todir.find().include(included).exclude(excluded).files().delete();

    // Copy all new or out of date jars to the target directory

    if (!this.todir.equals(this.from)) {
        Resources<com.wavemaker.tools.io.File> sourceRuntimeFileSet = this.from.find()
                .include(FilterOn.caseSensitiveNames().matching(runtimeJarNamesArr)).files();
        for (com.wavemaker.tools.io.File file : sourceRuntimeFileSet) {
            file.copyToIfNewer(this.todir);
        }
    }

    for (com.wavemaker.tools.io.File file : projectJars) {
        file.copyToIfNewer(this.todir);
    }

    copyPwsFiles(this.from, this.wmProject);
}

From source file:com.axelor.studio.service.data.exporter.ExporterService.java

private String[] addHelp(String docKey, String[] vals) {

    if (!docMap.isEmpty()) {

        if (docKey == null) {
            docKey = getDocKey(vals);/*w ww.  j av a 2s. c  o m*/
        }
        if (docMap.containsKey(docKey)) {
            return (String[]) ArrayUtils.addAll(vals, docMap.get(docKey));
        }
    }

    return vals;
}

From source file:msi.gama.util.matrix.GamaObjectMatrix.java

/**
 * Take two matrices (with the same number of columns) and create a big
 * matrix putting the second matrix on the right side of the first matrix
 *
 * @param two/*  w ww  .  j  ava 2s  .com*/
 *            matrix to concatenate
 * @return the matrix concatenated
 */

// @Override
// @operator(value = IKeyword.APPEND_VERTICALLY, content_type =
// ITypeProvider.CONTENT_TYPE_AT_INDEX + 1, category={IOperatorCategory.MATRIX})
public IMatrix<?> _opAppendVertically(final IScope scope, final IMatrix<?> b) {
    final GamaObjectMatrix a = this;
    final Object[] ma = a.getMatrix();
    final Object[] mb = ((GamaObjectMatrix) b).getMatrix();
    final Object[] mab = ArrayUtils.addAll(ma, mb);
    final IType<?> newContentsType = GamaType.findCommonType(getGamlType().getContentType(),
            b.getGamlType().getContentType());
    final IMatrix<?> fl = new GamaObjectMatrix(a.getCols(scope), a.getRows(scope) + b.getRows(scope), mab,
            newContentsType);

    // throw GamaRuntimeException.error("ATTENTION : Matrix additions not
    // implemented. Returns nil for the moment");
    return fl;
}

From source file:ml.shifu.shifu.guagua.ShifuInputFormat.java

protected void addCrossValidationDataset(List<InputSplit> trainingSplit, JobContext context)
        throws IOException {
    List<InputSplit> trainingNoMaster = new ArrayList<InputSplit>();
    for (InputSplit split : trainingSplit) {
        GuaguaInputSplit guaguaInput = (GuaguaInputSplit) split;
        if (guaguaInput.isMaster()) {
            continue;
        }/*w w w.ja v a 2s. co m*/
        trainingNoMaster.add(guaguaInput);
    }
    List<List<FileSplit>> csSplits = this.getCrossValidationSplits(context, trainingNoMaster.size());
    for (int i = 0; i < csSplits.size(); i++) {
        List<FileSplit> oneInput = csSplits.get(i);
        GuaguaInputSplit guaguaInput = (GuaguaInputSplit) trainingNoMaster.get(i);
        int trainingSize = guaguaInput.getFileSplits().length;
        FileSplit[] finalSplits = (FileSplit[]) ArrayUtils.addAll(guaguaInput.getFileSplits(),
                oneInput.toArray(new FileSplit[0]));
        guaguaInput.setFileSplits(finalSplits);
        Boolean[] validationFlags = new Boolean[finalSplits.length];
        for (int j = 0; j < finalSplits.length; j++) {
            validationFlags[j] = j < trainingSize ? false : true;
        }
        guaguaInput.setExtensions(validationFlags);
    }
    LOG.info("Training input split size is: {}.", trainingSplit.size());
    LOG.info("Validation input split size is {}.", csSplits.size());
}

From source file:com.rapidminer.operator.preprocessing.sampling.BootstrappingOperator.java

@Override
public OperatorVersion[] getIncompatibleVersionChanges() {
    return (OperatorVersion[]) ArrayUtils.addAll(super.getIncompatibleVersionChanges(),
            new OperatorVersion[] { VERSION_6_4_0 });
}

From source file:edu.utdallas.bigsecret.crypter.CrypterMode3.java

/**
 * {@inheritDoc}//  w  w  w  .  j ava2s  .c  o m
 */
public byte[] wrapQualifier(byte[] row, byte[] family, byte[] qualifier, long ts, byte[] value)
        throws Exception {
    if (row == null || row.length == 0)
        throw new Exception("Row is null or has no data");
    else if (family == null || family.length == 0)
        throw new Exception("Family is null or has no data");
    else if (qualifier == null || qualifier.length == 0)
        throw new Exception("Qualifier is null or has no data");

    byte[] sizeArray = Bytes.toBytes(row.length);
    sizeArray = ArrayUtils.addAll(sizeArray, Bytes.toBytes(family.length));
    sizeArray = ArrayUtils.addAll(sizeArray, Bytes.toBytes(qualifier.length));

    byte[] completeData = ArrayUtils.addAll(sizeArray, row);
    completeData = ArrayUtils.addAll(completeData, family);
    completeData = ArrayUtils.addAll(completeData, qualifier);
    completeData = ArrayUtils.addAll(completeData, Bytes.toBytes(ts));

    completeData = m_keyCipher.encrypt(completeData);

    return completeData;
}

From source file:com.bigdata.dastor.service.StorageProxy.java

private static void addHintHeader(Message message, InetAddress target) {
    byte[] oldHint = message.getHeader(RowMutation.HINT);
    byte[] hint = oldHint == null ? target.getAddress() : ArrayUtils.addAll(oldHint, target.getAddress());
    message.setHeader(RowMutation.HINT, hint);
}