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:marytts.unitselection.analysis.ProsodyAnalyzer.java

public double[] getDurationFactorsFramewise() {
    double[] f0Factors = null;
    for (Phone phone : phones) {
        double[] phoneF0Factors = phone.getFramewiseDurationFactors();
        f0Factors = ArrayUtils.addAll(f0Factors, phoneF0Factors);
    }/* w  w  w.  ja v  a  2s. co m*/
    return f0Factors;
}

From source file:com.prowidesoftware.swift.model.SwiftCharsetUtils.java

/**
 * Gets SWIFT z charset; all characters included in the X and Y sets, plus a couple of special characters.
 */// www.  j  a  v  a  2  s.  c om
static public char[] get_z() {
    char[] result = { '.', ',', '-', '(', ')', '/', '=', '\'', '+', ':', '?', '@', '#', ' ', '{', '!', '"', '%',
            '&', '*', ';', '<', '>', '_', '\n', '\r' };
    result = ArrayUtils.addAll(result, get_A());
    result = ArrayUtils.addAll(result, get_n());
    return result;
}

From source file:com.linkedin.cubert.analyzer.physical.CountDistinctRewriter.java

private void insertIncrementalMultipleDayGroupBy(ObjectNode programNode, Pair<ObjectNode, ObjectNode> bgInfo)
        throws AggregateRewriteException {
    String[] factColumns = lineage.getSchemaOutputColumns(bgInfo.getSecond());
    String[] sortKeys;//from  w w  w .jav  a 2  s. c  o m
    String[] groupByColumns;

    if (lineage.isBlockgenByIndex(bgInfo.getSecond())) {
        ObjectNode jobNode = lineage.getOperatorJobNode(bgInfo.getSecond());
        sortKeys = JsonUtils.asArray(((ObjectNode) (jobNode.get("shuffle"))).get("pivotKeys"));
        groupByColumns = (String[]) ArrayUtils.addAll(new String[] { "BLOCK_ID" }, factColumns);
    } else {
        sortKeys = JsonUtils.asArray(bgInfo.getSecond().get("pivotKeys"));
        groupByColumns = factColumns;
    }

    // check sort key condition
    if (!CommonUtils.isPrefix(sortKeys, groupByColumns))
        throw new AggregateRewriteException("Blockgen of union fact not sorted by fact collumns");

    ArrayNode aggsNode = JsonUtils.createArrayNode();
    ArrayNode udafArgsNode = JsonUtils.createArrayNode();

    String startDateHyphenated = DateTimeUtilities.getHyphenated(this.factStartDate);
    udafArgsNode.add(startDateHyphenated);
    aggsNode.add(RewriteUtils.createObjectNode("type", "USER_DEFINED_AGGREGATION", "udaf",
            "com.linkedin.cubert.operator.aggregate.PresenceBitmapUDAF", "constructorArgs", udafArgsNode,
            "input", DATE_COLUMN_NAME, "output", BITMAP_COLUMN_NAME));
    String blockgenInputRelation = lineage.getOperatorSources(bgInfo.getSecond()).get(0).get("output")
            .getTextValue();
    ObjectNode groupByNode = RewriteUtils.createObjectNode("operator", "GROUP_BY", "input",
            blockgenInputRelation, "output", blockgenInputRelation, "groupBy",
            JsonUtils.createArrayNode(groupByColumns), "aggregates", aggsNode);

    ArrayNode phaseOperators = lineage.getPhaseOperators(lineage.getPhase(bgInfo.getSecond()));
    int blockGenIndex = 0;
    for (; blockGenIndex < phaseOperators.size(); blockGenIndex++) {
        if (phaseOperators.get(blockGenIndex) == bgInfo.getSecond())
            break;
    }
    if (blockGenIndex == phaseOperators.size())
        throw new RuntimeException("Cannot find CREATE_BLOCK operator in phase operator list");
    phaseOperators.insert(blockGenIndex, groupByNode);
    // phaseOperators.insert(blockGenIndex + 1, generateNode);

}

From source file:com.github.kuben.realshopping.RSPlayerInventory.java

private Map<Price, Integer> invToPInv() {
    //Guess it is safe to use getPlayerExact, because this will only be called with an online player.
    //Will throw NullPointer otherwise
    Object[] IS = ArrayUtils.addAll(Bukkit.getPlayerExact(player).getInventory().getContents(),
            Bukkit.getPlayerExact(player).getInventory().getArmorContents());
    //            ItemStack[] IS = new ItemStack[obj.length];
    ////from   w w w .j  a  va2s.co m
    //            for(int i = 0;i < obj.length;i++)
    //                    IS[i] = (ItemStack) obj[i];
    return invToPInv((ItemStack[]) IS);
}

From source file:com.salesforce.hbase.index.covered.example.CoveredColumnIndexCodec.java

/**
 * Compose the final index row key./*ww  w. j av a  2  s.  com*/
 * <p>
 * This is faster than adding each value independently as we can just build a single a array and
 * copy everything over once.
 * @param pk primary key of the original row
 * @param length total number of bytes of all the values that should be added
 * @param values to use when building the key
 * @return
 */
static byte[] composeRowKey(byte[] pk, int length, List<ColumnEntry> values) {
    // now build up expected row key, each of the values, in order, followed by the PK and then some
    // info about lengths so we can deserialize each value
    byte[] output = new byte[length + pk.length];
    int pos = 0;
    int[] lengths = new int[values.size()];
    int i = 0;
    for (ColumnEntry entry : values) {
        byte[] v = entry.value;
        // skip doing the copy attempt, if we don't need to
        if (v.length != 0) {
            System.arraycopy(v, 0, output, pos, v.length);
            pos += v.length;
        }
        lengths[i++] = v.length;
    }

    // add the primary key to the end of the row key
    System.arraycopy(pk, 0, output, pos, pk.length);

    // add the lengths as suffixes so we can deserialize the elements again
    for (int l : lengths) {
        output = ArrayUtils.addAll(output, Bytes.toBytes(l));
    }

    // and the last integer is the number of values
    return ArrayUtils.addAll(output, Bytes.toBytes(values.size()));
}

From source file:de.tudarmstadt.ukp.dkpro.core.stanfordnlp.StanfordPosTaggerTest.java

/**
 * Setup CAS to test parser for the English language (is only called once if an English test is
 * run)/*from  ww w  .  jav a  2 s.  c o  m*/
 */
private JCas runTest(String aLanguage, String aVariant, String aText, Object... aExtraParams) throws Exception {
    // No automatic downloading from repository during testing. This makes sure we fail if
    // models are not properly added as test dependencies.
    System.setProperty(ResourceObjectProviderBase.PROP_REPO_OFFLINE, "true");

    AssumeResource.assumeResource(StanfordPosTagger.class, "tagger", aLanguage, aVariant);

    AnalysisEngineDescription segmenter;

    if ("zh".equals(aLanguage)) {
        segmenter = createEngineDescription(LanguageToolSegmenter.class);
    } else {
        segmenter = createEngineDescription(StanfordSegmenter.class);
    }

    Object[] params = new Object[] { StanfordPosTagger.PARAM_VARIANT, aVariant,
            StanfordPosTagger.PARAM_PRINT_TAGSET, true };
    params = ArrayUtils.addAll(params, aExtraParams);
    AnalysisEngineDescription parser = createEngineDescription(StanfordPosTagger.class, params);

    AnalysisEngine engine = createEngine(createEngineDescription(segmenter, parser));

    JCas jcas = engine.newJCas();
    jcas.setDocumentLanguage(aLanguage);
    jcas.setDocumentText(aText);
    engine.process(jcas);

    return jcas;
}

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

public String[] toString(SerenityLoans plugin)
        throws InterruptedException, ExecutionException, TimeoutException {
    String[] result = { String.format("    Balance: %s", plugin.econ.format(balance)),
            String.format("    Interest balance: %s", plugin.econ.format(interestBalance)),
            String.format("    Fee balance: %s", plugin.econ.format(feeBalance)),
            String.format("    Open date: %F", new Date(startDate.getTime())), "",
            String.format("    Lender: %s", plugin.playerManager.entityNameLookup(getLender())),
            String.format("    Borrower: %s", plugin.playerManager.entityNameLookup(getBorrower())),
            String.format("    Loan value: %s", plugin.econ.format(getValue())),
            String.format("    Interest rate: %s (%s)", plugin.econ.formatPercent(getInterestRate()),
                    Conf.getIntReportingString()),
            String.format("    Minimum payment: %s", plugin.econ.format(getMinPayment())),
            String.format("    Term: %s", Conf.buildTimeString(getTerm())),
            String.format("    Compounding period: %s", Conf.buildTimeString(getCompoundingPeriod())),
            String.format("    Payment time: %s", Conf.buildTimeString(getPaymentTime())),
            String.format("    Payment frequency: %s", Conf.buildTimeString(getPaymentFrequency())),
            String.format("    Loan type: %s", getLoanType()) };

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

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

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

    return result;
}

From source file:marytts.unitselection.analysis.ProsodyAnalyzer.java

public double[] getFrameMidTimes() {
    double[] frameDurations = null;
    for (Phone phone : phones) {
        double[] phoneFrameDurations = phone.getFrameDurations();
        frameDurations = ArrayUtils.addAll(frameDurations, phoneFrameDurations);
    }/*w ww .j  a va2 s  .  c  o m*/

    assert frameDurations != null;
    double[] frameMidTimes = new double[frameDurations.length];
    double frameStartTime = 0;
    for (int f = 0; f < frameDurations.length; f++) {
        frameMidTimes[f] = frameStartTime + frameDurations[f] / 2;
        frameStartTime += frameDurations[f];
    }

    return frameMidTimes;
}

From source file:com.prowidesoftware.swift.model.SwiftCharsetUtils.java

/**
 * Gets SWIFT c charset; alpha-numeric capital letters (upper case), and digits only.
 *///from www.j a v a 2s.  c  o  m
static public char[] get_c() {
    char[] result = get_a();
    return ArrayUtils.addAll(result, get_n());
}

From source file:com.prowidesoftware.swift.model.SwiftCharsetUtils.java

/**
 * Gets SWIFT B charset; alphanumeric upper case or lower case A through Z, a through z and 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
 *//*from   w w  w .j  a  v  a 2 s  . c  o m*/
static public char[] get_B() {
    char[] result = get_A();
    return ArrayUtils.addAll(result, get_n());
}