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:fi.aalto.hacid.HAcidTxn.java

Collection<byte[]> getReadset() {
    // Make column names for the col.family 'readset'
    HashSet<byte[]> readsetRows = new HashSet<byte[]>(reads.size());
    for (HAcidGet pg : reads) {
        readsetRows.add(//from   w w  w  .  j av  a 2  s.c  o  m
                ArrayUtils.addAll(ArrayUtils.addAll(pg.hacidtable.getTableName(), Bytes.toBytes(":")), pg.row));
    }
    return readsetRows;
}

From source file:com.dp2345.service.impl.BaseServiceImpl.java

@Transactional
public T update(T entity, String... ignoreProperties) {
    Assert.notNull(entity);//  w ww.jav a  2  s.  c  o m
    if (baseDao.isManaged(entity)) {
        throw new IllegalArgumentException("Entity must not be managed");
    }
    T persistant = baseDao.find(baseDao.getIdentifier(entity));
    if (persistant != null) {
        copyProperties(entity, persistant,
                (String[]) ArrayUtils.addAll(ignoreProperties, UPDATE_IGNORE_PROPERTIES));
        return update(persistant);
    } else {
        return update(entity);
    }
}

From source file:com.willetinc.hadoop.mapreduce.dynamodb.BinarySplitter.java

@Override
void generateRangeKeySplits(Configuration conf, List<InputSplit> splits, Types hashKeyType,
        AttributeValue hashKeyValue, Types rangeKeyType, AttributeValue minRangeKeyValue,
        AttributeValue maxRangeKeyValue, int numRangeSplits) {

    byte[] minBytes = minRangeKeyValue.getB().array();
    byte[] maxBytes = maxRangeKeyValue.getB().array();

    // If there is a common prefix between minString and maxString,
    // establish it
    // and pull it out of minString and maxString.
    int maxPrefixLen = Math.min(minBytes.length, maxBytes.length);
    int sharedLen;
    for (sharedLen = 0; sharedLen < maxPrefixLen; sharedLen++) {
        byte b1 = minBytes[sharedLen];
        byte b2 = maxBytes[sharedLen];
        if (b1 != b2) {
            break;
        }/* www  .  jav a 2s.c o  m*/
    }

    // The common prefix has length 'sharedLen'. Extract it from both.
    byte[] commonPrefix = Arrays.copyOfRange(minBytes, 0, sharedLen);
    minBytes = Arrays.copyOfRange(minBytes, sharedLen, minBytes.length);
    maxBytes = Arrays.copyOfRange(maxBytes, sharedLen, maxBytes.length);

    List<BigDecimal> splitValues = split(numRangeSplits, minBytes, maxBytes);

    // Convert the list of split point strings into an actual set of
    // InputSplits.
    byte[] start = ArrayUtils.addAll(commonPrefix, bigDecimalToByteArray(splitValues.get(0), MAX_BYTES));
    for (int i = 1; i < splitValues.size(); i++) {
        byte[] end = ArrayUtils.addAll(commonPrefix, bigDecimalToByteArray(splitValues.get(i), MAX_BYTES));

        //if (compareBytes(start, end) >= 0)
        //   continue;

        List<AttributeValue> rangeKeyValues = new ArrayList<AttributeValue>();
        rangeKeyValues.add(new AttributeValue().withB(ByteBuffer.wrap(start)));
        rangeKeyValues.add(new AttributeValue().withB(ByteBuffer.wrap(end)));

        splits.add(new DynamoDBQueryInputFormat.DynamoDBQueryInputSplit(hashKeyType, hashKeyValue, rangeKeyType,
                rangeKeyValues, ComparisonOperator.BETWEEN));

        start = ArrayUtils.addAll(end, new byte[] { 0x0 });
    }
}

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

private static void addColumnsToPut(Put indexInsert, List<ColumnEntry> columns) {
    // add each of the corresponding families to the put
    int count = 0;
    for (ColumnEntry column : columns) {
        indexInsert.add(INDEX_ROW_COLUMN_FAMILY,
                ArrayUtils.addAll(Bytes.toBytes(count++), toIndexQualifier(column.ref)), null);
    }//from   w w  w  .  ja v a  2 s. c  o  m
}

From source file:com.avatarproject.core.command.APTabCompleter.java

@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args) {
    List<String> complete = new ArrayList<String>();
    if (cmd.getName().equalsIgnoreCase("avatar")) {
        if (args.length == 1) {
            List<String> possible = new ArrayList<String>();
            for (APCommand command : APCommand.instances.values()) {
                if (hasPermission(sender, command.getName())) {
                    possible.add(command.getAliases()[0]);
                }/*from  w  w  w  .j  a  va2 s . c o m*/
            }
            return getPossibleCompletionsForGivenArgs(args, possible);
        }
        if (args.length > 1) {
            for (APCommand command : APCommand.instances.values()) {
                if (ArrayUtils.contains(command.getAliases(), args[0].toLowerCase())) {
                    if (command.getCompleters() != null) {
                        if (command.getCompleters().length >= (args.length - 1)) {
                            String[] completers = command.getCompleters()[(args.length - 2)];
                            if (Arrays.asList(completers).contains("%custom")) {
                                completers = (String[]) ArrayUtils.removeElement(completers, "%custom");
                                completers = (String[]) ArrayUtils.addAll(completers,
                                        command.tabComplete(sender, args));
                            }
                            if (Arrays.asList(completers).contains("%player")) {
                                completers = (String[]) ArrayUtils.removeElement(completers, "%player");
                                List<String> array = new ArrayList<String>();
                                for (Player p : Bukkit.getOnlinePlayers()) {
                                    array.add(p.getName());
                                }
                                completers = (String[]) ArrayUtils.addAll(completers,
                                        array.toArray(new String[array.size()]));
                            }
                            return getPossibleCompletionsForGivenArgs(args, completers);
                        }
                    }
                }
            }
        }
    }
    return complete;
}

From source file:de.ingrid.admin.elasticsearch.IndexImpl.java

@Autowired
public IndexImpl(IndexManager indexManager, QueryConverter qc, FacetConverter fc) {
    this.config = JettyStarter.getInstance().config;
    this.indexManager = indexManager;
    this.searchType = ElasticSearchUtils.getSearchTypeFromString(config.searchType);
    this.detailFields = (String[]) ArrayUtils.addAll(
            new String[] { config.indexFieldTitle, config.indexFieldSummary },
            config.additionalSearchDetailFields);

    try {//from   www  .  j  a  va 2 s. co m
        this.queryConverter = qc;
        this.facetConverter = fc;

        log.info("Elastic Search Settings: " + indexManager.printSettings());

    } catch (Exception e) {
        log.error("Error during initialization of ElasticSearch-Client!");
        e.printStackTrace();
    }

}

From source file:gda.gui.scriptcontroller.logging.ScriptControllerLogView.java

protected void updateFilter(String[] knownScriptTypes) {
    String[] newScriptTypes = new String[] { ScriptControllerLogFilter.ALL };
    scriptTypes = (String[]) ArrayUtils.addAll(newScriptTypes, knownScriptTypes);

    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
        @Override/*from  www.  j  ava 2  s .c  om*/
        public void run() {
            String currentChoice = cmbFilter.getItem(cmbFilter.getSelectionIndex());

            int newIndexOfCurrentChoice = ArrayUtils.indexOf(scriptTypes, currentChoice);
            if (newIndexOfCurrentChoice == -1) {
                newIndexOfCurrentChoice = 0;
            }

            cmbFilter.setItems(scriptTypes);
            cmbFilter.select(newIndexOfCurrentChoice);
        }
    });
}

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

private static byte[] toIndexQualifier(CoveredColumn column) {
    return ArrayUtils.addAll(Bytes.toBytes(column.familyString + CoveredColumn.SEPARATOR),
            column.getQualifier());/* w w  w .j  a v  a  2  s  .co m*/
}

From source file:com.cnd.greencube.server.business.impl.BaseBusinessImpl.java

@Transactional
public T update(T entity, String... ignoreProperties) {
    Assert.notNull(entity);/* w w w  .  j av  a2  s .com*/
    if (dao.isManaged(entity)) {
        throw new IllegalArgumentException("Entity must not be managed");
    }
    T persistant = dao.get(dao.getIdentifier(entity));
    if (persistant != null) {
        copyProperties(entity, persistant,
                (String[]) ArrayUtils.addAll(ignoreProperties, UPDATE_IGNORE_PROPERTIES));
        return update(persistant);
    } else {
        return update(entity);
    }
}

From source file:dk.alexandra.fresco.lib.helper.bristol.BristolCircuit.java

@Override
public Value[] getInputValues() {
    return (Value[]) ArrayUtils.addAll(this.in1, this.in2);
}