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:com.laex.cg2d.model.joints.BEDistanceJoint.java

@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
    return (IPropertyDescriptor[]) ArrayUtils.addAll(super.getPropertyDescriptors(), descriptor);
}

From source file:com.opengamma.analytics.financial.calculator.PortfolioHedgingCalculator.java

/**
 * Convert the parameter sensitivity into a matrix (DoubleMatrix1D). All the sensitivities should be in the same currency.
 * The matrix is composed of the sensitivity vectors (currency is ignored) one after the other.
 * The matrix order is the one of the set.
 * @param sensi The sensitivity.//from  w ww.j a  v  a2s  .  c o m
 * @param order The ordered set of name.
 * @return The sensitivity matrix.
 */
public static DoubleMatrix1D toMatrix(final MultipleCurrencyParameterSensitivity sensi,
        final LinkedHashSet<Pair<String, Integer>> order) {
    double[] psArray = new double[0];
    final Currency ccy = sensi.getAllNamesCurrency().iterator().next().getSecond();
    // Implementation note: all the currencies are supposed to be the same, we choose any of them.
    for (final Pair<String, Integer> nameSize : order) {
        if (sensi.getSensitivities().containsKey(new ObjectsPair<>(nameSize.getFirst(), ccy))) {
            psArray = ArrayUtils.addAll(psArray, sensi.getSensitivity(nameSize.getFirst(), ccy).getData());
        } else { // When curve is not in the sensitivity, add zeros.
            psArray = ArrayUtils.addAll(psArray, new double[nameSize.getSecond()]);
        }
    }
    return new DoubleMatrix1D(psArray);
}

From source file:com.twinsoft.convertigo.beans.core.MySimpleBeanInfo.java

private void checkLocalProperties() {
    if (localProperties == null) {
        localProperties = new PropertyDescriptor[0];
        ArrayUtils.addAll(localProperties, properties);
    }/*from   w w w  . ja  v a 2 s. c o m*/
}

From source file:de.tudarmstadt.ukp.dkpro.core.clearnlp.ClearNlpSemanticRoleLabelerTest.java

private JCas runTest(String aLanguage, String aVariant, String aText, Object... aExtraParams) throws Exception {
    Object[] params = new Object[] { ClearNlpParser.PARAM_VARIANT, aVariant, ClearNlpParser.PARAM_PRINT_TAGSET,
            true };//from  w  w w  .j  av a  2s. co m
    params = ArrayUtils.addAll(params, aExtraParams);

    AnalysisEngineDescription engine = createEngineDescription(createEngineDescription(OpenNlpPosTagger.class),
            createEngineDescription(ClearNlpLemmatizer.class), createEngineDescription(ClearNlpParser.class),
            createEngineDescription(ClearNlpSemanticRoleLabeler.class, params));

    return TestRunner.runTest(engine, aLanguage, aText);
}

From source file:com.kakao.hbase.common.Args.java

public Args(String[] args) throws IOException {
    OptionSet optionSetTemp = createOptionParser().parse(args);

    List<?> nonOptionArguments = optionSetTemp.nonOptionArguments();
    if (nonOptionArguments.size() < 1)
        throw new IllegalArgumentException(INVALID_ARGUMENTS);

    String arg = (String) nonOptionArguments.get(0);

    if (Util.isFile(arg)) {
        String[] newArgs = (String[]) ArrayUtils.addAll(parseArgsFile(arg),
                Arrays.copyOfRange(args, 1, args.length));
        this.optionSet = createOptionParser().parse(newArgs);
        this.zookeeperQuorum = (String) optionSet.nonOptionArguments().get(0);
    } else {//from w ww .j  a v  a  2s .c  om
        this.optionSet = optionSetTemp;
        this.zookeeperQuorum = arg;
    }
}

From source file:com.ejwa.dinja.utility.ArrayHelper.java

/**
 * Returns the index, within a wrapped array, of the first occurrence of one of the specified subarray chunks. This
 * method works in a similar fashion to {@link #indexOfSubArrayWrapped(Object[], Object[]) indexOfSubArrayWrapped(T[], T[])},
 * but searches for chunks of size <code>subArrayChunkSize</code> from the subarray when searching through the array.
 *
 * @param array An array to search in.//from  ww  w .  ja  v a2  s .  c om
 * @param subArray The subarray for which to search from.
 * @param subArrayChunkSize Size of the chunks to pick from the subarray when searching through the array.
 * @return The index within this array of the first occurrence of one of the specified subarray chunks.
 * @see #indexOfSubArrayWrapped(Object[], Object[]) indexOfSubArrayWrapped(T[], T[])
 */
public static <T> int indexOfSubArrayChunkWrapped(T[] array, T[] subArray, int subArrayChunkSize) {
    return indexOfSubArrayChunk(ArrayUtils.addAll(array, array), subArray, subArrayChunkSize);
}

From source file:au.org.ala.biocache.dto.SpatialSearchRequestParams.java

/**
 * Get the value of fq.  // w w  w  .j a  v  a2s.co  m
 * 
 * Adds the gk FQ if necessary...
 *
 * @return the value of fq
 */
public String[] getFq() {
    if (gk) {
        return (String[]) ArrayUtils.addAll(fq, gkFq);
    } else {
        return fq;
    }
}

From source file:com.ucuenca.pentaho.plugin.step.ontologymapping.OntoMapData.java

/**
 * Saves table data on DB Schema//www .j a va 2  s  .  c o m
 * @param table Dialog TableView
 * @param tableName DB table name
 * @return List of generated SQL INSERT statements
 * @throws Exception
 */
public List<String> saveTable(TableView table, String tableName) throws Exception {
    List<String> sqlInsertList = new ArrayList<String>();
    this.createDBTable(table, tableName);
    Object[] pk = new Object[] { this.getTransName().toUpperCase(), this.getStepName().toUpperCase() };
    DatabaseLoader.executeUpdate("DELETE FROM " + tableName + " WHERE TRANSID = ? AND STEPID = ?", pk);
    for (int i = 0; i < table.getItemCount(); i++) {
        Object[] tableValues = table.getItem(i);
        Object[] values = pk;
        values = ArrayUtils.addAll(values, tableValues);
        if (((String) values[2]).length() > 0) {
            try {
                String sqlInsertion = "INSERT INTO " + tableName + " VALUES(";
                String sqlInsertStack = sqlInsertion;
                int count = 1;
                while (count < values.length) {
                    sqlInsertion += "?,";
                    sqlInsertStack += "{" + (count - 1) + "},";
                    count++;
                }
                sqlInsertion += "?)";
                sqlInsertStack += "{" + (values.length - 1) + "})";
                DatabaseLoader.executeUpdate(sqlInsertion, values);
                sqlInsertList.add(new MessageFormat(sqlInsertStack).format(
                        this.setValuesFormat(ArrayUtils.addAll(new Object[] { "{0}", "{1}" }, tableValues))));
            } catch (Exception e) {
                throw new KettleException("ERROR EXECUTING SQL INSERT: " + e.getMessage());
            }
        }
    }
    return sqlInsertList;
}

From source file:com.apporiented.hermesftp.streams.BlockModeInputStream.java

/**
 * {@inheritDoc}/*from   w w  w  .j  av  a 2s.co m*/
 */
public int read() throws IOException {
    if (buffer == null) {
        if (eof) {
            return -1;
        }
        int descriptor = is.read();
        int hi = is.read();
        int lo = is.read();
        checkHeader(descriptor, hi, lo);
        int len = hi << 8 | lo;
        buffer = new byte[len];
        int realLength = is.read(buffer);
        if (realLength != len) {
            throw new IOException(UNEXPECTED_END_OF_STREAM);
        }
        eof = (descriptor & BlockModeConstants.DESC_CODE_EOF) > 0;
        eor = (descriptor & BlockModeConstants.DESC_CODE_EOR) > 0;
        boolean mark = (descriptor & BlockModeConstants.DESC_CODE_REST) > 0;
        if (mark) {
            setRestartMarker();
            buffer = null;
            return read();
        }
        byteCount += len;
        if (eor) {
            buffer = ArrayUtils.addAll(buffer, eorMarkerBytes);
        }
    }
    int result = buffer[idx];
    idx++;
    if (idx >= buffer.length) {
        buffer = null;
        idx = 0;
    }
    return result;
}

From source file:info.archinnov.achilles.internal.statement.StatementGenerator.java

public Pair<Insert, Object[]> generateInsert(Object entity, EntityMeta entityMeta) {
    PropertyMeta idMeta = entityMeta.getIdMeta();
    Insert insert = insertInto(entityMeta.getTableName());
    final Object[] boundValuesForPK = generateInsertPrimaryKey(entity, idMeta, insert);

    List<PropertyMeta> fieldMetas = new ArrayList<>(entityMeta.getColumnsMetaToInsert());

    final Object[] boundValuesForColumns = new Object[fieldMetas.size()];
    for (int i = 0; i < fieldMetas.size(); i++) {
        PropertyMeta pm = fieldMetas.get(i);
        Object value = pm.getAndEncodeValueForCassandra(entity);
        insert.value(pm.getPropertyName(), value);
        boundValuesForColumns[i] = value;
    }// w  w w . java  2  s  . c  o m
    final Object[] boundValues = ArrayUtils.addAll(boundValuesForPK, boundValuesForColumns);
    return Pair.create(insert, boundValues);
}