当前位置: 首页>>代码示例>>Java>>正文


Java ArrayUtils.addAll方法代码示例

本文整理汇总了Java中org.apache.commons.lang.ArrayUtils.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayUtils.addAll方法的具体用法?Java ArrayUtils.addAll怎么用?Java ArrayUtils.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.ArrayUtils的用法示例。


在下文中一共展示了ArrayUtils.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateBubiPriKey

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
/**
 * 根据ED25519算法生成的私钥进行加工,从而得到布比私钥
 * 1.将3字节前缀和1字节版本号0XDA379F01加到P前面,1字节压缩标志添加到P后面即 M=0XDA379F01 + P+0X00
 * 2.将M用SHA256计算两次取前4字节,即Checksum=SHA256(SHA256(M)) 的前4字节
 * 3.将Checksum的前四字节加到M后面,即S=M+Checksum
 * 4.对S进行Base58编码即得到布比私钥。privxxxxxxxxxxxxxxxxxxxxxxxx
 *
 * @param priKey
 * @return
 */
private static String generateBubiPriKey(EdDSAPrivateKey priKey){
    try {
        byte[] priKeyheadArr = Utils.hexToBytes("DA379F01");
        byte[] M = ArrayUtils.addAll(priKeyheadArr, priKey.getSeed());
        byte[] priKeyendArr = Utils.hexToBytes("00");
        M = ArrayUtils.addAll(M, priKeyendArr);
        MessageDigest md = MessageDigest.getInstance("SHA-256");
        md.update(M);
        byte[] m_256_1 = md.digest();
        md.update(m_256_1);
        byte[] m_256_2 = md.digest();
        byte[] M_check = new byte[M.length + 4];
        System.arraycopy(M, 0, M_check, 0, M.length);
        System.arraycopy(m_256_2, 0, M_check, M.length, 4);
        return Base58Utils.encode(M_check);
    } catch (NoSuchAlgorithmException e) {
        throw new RuntimeException("Error occured on generating BubiAddress!--" + e.getMessage(), e);
    }
}
 
开发者ID:bubicn,项目名称:bubichain-sdk-java,代码行数:30,代码来源:BlockchainKeyPairFactory.java

示例2: getInventoryManifestMD5Mismatch

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
@Test (expected = ChecksumMismatchException.class)
public void getInventoryManifestMD5Mismatch() throws Exception {
    InventoryManifest expectedManifest = manifest();
    byte[] expectedManifestBytes = manifestBytes(expectedManifest);
    byte[] errorBytes = "ERROR".getBytes();
    byte[] wrongManifestBytes = ArrayUtils.addAll(expectedManifestBytes, errorBytes);
    when(mockS3JsonObject.getObjectContent()).thenReturn(new S3ObjectInputStream(
            new ByteArrayInputStream(wrongManifestBytes), null));
    String expectedChecksum = "37289f10a76751046658f6c5e0ab41d9";

    byte[] expectedChecksumBytes = expectedChecksum.getBytes(StandardCharsets.UTF_8);
    when(mockS3ChecksumObject.getObjectContent()).thenReturn(new S3ObjectInputStream(
            new ByteArrayInputStream(expectedChecksumBytes), null));
    when(mockS3Client.getObject(getObjectRequestCaptor.capture())).
            thenReturn(mockS3JsonObject)
            .thenReturn(mockS3ChecksumObject);
    retriever.getInventoryManifest();
}
 
开发者ID:awslabs,项目名称:s3-inventory-usage-examples,代码行数:19,代码来源:InventoryManifestRetrieverTest.java

示例3: getSynsetsFromWord

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
/**
 * Extract from WordNet Database the synsets of a word
 * @param wnDatabase WordNet Database
 * @param word The word that we want to extract its synsets
 * @param synsetType POS Tag of the word
 * @return Array of Synsets
 */
public static Synset[] getSynsetsFromWord(WordNetDatabase wnDatabase, String word, SynsetType synsetType) {
    Synset[] tmpSynsets;

    if(synsetType == null)
        tmpSynsets = wnDatabase.getSynsets(word);
    else {
        tmpSynsets = wnDatabase.getSynsets(word, synsetType);

        // If the synset type is an adjective, check for adjective satellite too
        if (synsetType == SynsetType.ADJECTIVE) {
            tmpSynsets = (Synset[])ArrayUtils.addAll(tmpSynsets, wnDatabase.getSynsets(word, SynsetType.ADJECTIVE_SATELLITE));
        }
    }

    return tmpSynsets;
}
 
开发者ID:butnaruandrei,项目名称:ShotgunWSD,代码行数:24,代码来源:WordUtils.java

示例4: tranformOneInstanceToBaseLearnerRegressionDataset

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
/**
 * It transform one instance of the Object Ranking dataset to {@link BaselearnerDataset} for
 * running regression.
 * 
 * @param objectRankingInstance the object ranking instance to be used for transformation
 * @return the base learner dataset to be used for learning the linear regression function
 */
public static BaselearnerDataset tranformOneInstanceToBaseLearnerRegressionDataset(ObjectRankingInstance objectRankingInstance) {
   Ranking ranking = objectRankingInstance.getRating();
   int numOfObjectsInPartialOrder = ranking.getObjectList().length;
   int numberOfFeatures = objectRankingInstance.getNumofItemFeatures();
   int numberOfContextFeatures = objectRankingInstance.getNumberOfContextsFeatures();
   BaselearnerDataset transformedDataset = new BaselearnerDataset(numOfObjectsInPartialOrder,
         numberOfFeatures + numberOfContextFeatures);
   double rank = 1;
   for (int obj : ranking.getObjectList()) {
      double expectedRank = rank / (numOfObjectsInPartialOrder + 1);
      double[] features = ArrayUtils.addAll(objectRankingInstance.getContextFeatureVector(),
            objectRankingInstance.getFeaturesForItem(obj));

      BaselearnerInstance instance = new BaselearnerInstance(features, expectedRank);
      transformedDataset.addInstance(instance);
      rank++;
   }
   return transformedDataset;
}
 
开发者ID:Intelligent-Systems-Group,项目名称:jpl-framework,代码行数:27,代码来源:RankingRegressionTransformerUtils.java

示例5: listTables

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
@Override
public List<SchemaTableName> listTables(ConnectorSession connectorSession, String s)
{
    log.info("INFORMATION: AmpoolMetadata listTables() called.");

    if (s == null) {
        return listTables(connectorSession, "ampool");
    }

    String[] fTableNames = ampoolClient.getAdmin().listFTableNames();
    String[] mTableNames = ampoolClient.getAdmin().listMTableNames();
    String[] tableNames = (String[]) ArrayUtils.addAll(fTableNames, mTableNames);
    ImmutableList.Builder<SchemaTableName> tables = ImmutableList.builder();
    for (String n : tableNames)
    {
        tables.add(new SchemaTableName("ampool", n));
    }

    return tables.build();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:21,代码来源:AmpoolMetadata.java

示例6: RWQueueRpcExecutor

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
public RWQueueRpcExecutor(final String name, final int handlerCount, final int numQueues,
    final float readShare, final float scanShare, final int maxQueueLength,
    final Configuration conf, final Abortable abortable,
    final Class<? extends BlockingQueue> readQueueClass, Object... readQueueInitArgs) {
  this(name, calcNumWriters(handlerCount, readShare), calcNumReaders(handlerCount, readShare),
    calcNumWriters(numQueues, readShare), calcNumReaders(numQueues, readShare), scanShare,
    LinkedBlockingQueue.class, new Object[] {maxQueueLength},
    readQueueClass, ArrayUtils.addAll(new Object[] {maxQueueLength}, readQueueInitArgs));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:10,代码来源:RWQueueRpcExecutor.java

示例7: loadProperties

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
/**
 * 
 * loading the properties files without open jon file
 * @param jobFile job file path
 */
public void loadProperties(IFile jobFile) {
	List<File> paramNameList = null;
	IProject activeProject = jobFile.getProject();
	final File globalparamFilesPath = new File(activeProject.getLocation().toString() + "/" + "globalparam");
	final File localParamFilePath = new File(activeProject.getLocation().toString() + "/" + Constants.PARAM_FOLDER);
	File[] files = (File[]) ArrayUtils.addAll(listFilesForFolder(globalparamFilesPath),
			getJobsPropertyFile(localParamFilePath, jobFile));
	if (files != null) {
		paramNameList = Arrays.asList(files);
		getParamMap(paramNameList, jobFile);
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:18,代码来源:Utils.java

示例8: getResourceAddress

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
public static final String getResourceAddress(boolean isFromGameResourceInput, String... fileResourcePathComponents)
{
	if (isFromGameResourceInput)
	{
		final String[] inputGameResourceArray = {BuenOjoFileUtils.GAME_RESOURCES_INPUT_DIR};
		fileResourcePathComponents = (String[]) ArrayUtils.addAll(inputGameResourceArray, fileResourcePathComponents);
	}	
	return getResourceAddress(fileResourcePathComponents);
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:10,代码来源:ResourceHelper.java

示例9: setPortId

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
public void setPortId(final int portNumber) {
    byte[] port = ArrayUtils.addAll(new byte[] {PORT_TLV_SUBTYPE},
                                    ByteBuffer.allocate(4).putInt(portNumber).array());

    LLDPTLV portTLV = new LLDPTLV();
    portTLV.setLength(PORT_TLV_SIZE);
    portTLV.setType(PORT_TLV_TYPE);
    portTLV.setValue(port);
    this.setPortId(portTLV);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:ONOSLLDP.java

示例10: transformInstanceToPairswisePreferencesClassifcationDataset

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
/**
 * The method to transform the provided {@link ObjectRankingInstance} to classifier
 * {@link BaselearnerDataset}. This function takes one ranking and generate all possible
 * combinations of pair wise preferences. Suppose if x1 is ranked before x2 then it creates an
 * instance with weights (features(x1-x2)) and class as 1. or an instance with weights
 * (features(x2-x1)) and class -1. The output dataset contains balanced classes, i.e. there are
 * the same number of -1 as +1
 * 
 * @param objectRankingInstance the dataset to be transformed
 * @return the transformed base learner dataset
 */
public static BaselearnerDataset transformInstanceToPairswisePreferencesClassifcationDataset(
      ObjectRankingInstance objectRankingInstance) {
   int[] objects = objectRankingInstance.getRating().getObjectList();
   List<Integer> listOfIndexes = CollectionsUtils.createListOfIndexesForProvidedNumber(objects.length);
   List<Integer[]> combination = PermuatorCombinator.getCombinationsnCr(listOfIndexes, 2);
   int numberOfItemFeatures = objectRankingInstance.getNumofItemFeatures();
   int numberOfContextFeatures = objectRankingInstance.getNumberOfContextsFeatures();
   BaselearnerDataset transformedDataset = new BaselearnerDataset(combination.size(), numberOfItemFeatures + numberOfContextFeatures);
   int k = 1;
   double[] contextFeatures = objectRankingInstance.getContextFeatureVector();
   for (Integer[] obj : combination) {

      double[] itemFeaturesForObjectOne = objectRankingInstance.getFeaturesForItem(objects[obj[0]]);
      double[] itemFeaturesForObjectTwo = objectRankingInstance.getFeaturesForItem(objects[obj[1]]);
      DenseDoubleVector featureVector = new DenseDoubleVector(itemFeaturesForObjectOne);
      featureVector.subtractVector(itemFeaturesForObjectTwo);
      double classValue = Math.signum(obj[1] - (double) obj[0]);
      if (Double.compare(classValue, Math.pow(-1, k)) != 0) {
         featureVector.multiplyByConstant(-1);
         classValue = classValue * -1;
      }
      BaselearnerInstance instance = new BaselearnerInstance(ArrayUtils.addAll(contextFeatures, featureVector.asArray()), classValue);
      transformedDataset.addInstance(instance);
      k++;
   }
   return transformedDataset;
}
 
开发者ID:Intelligent-Systems-Group,项目名称:jpl-framework,代码行数:39,代码来源:PairwiseRankingTransformerUtils.java

示例11: transformInstanceToOrderedPairwiseClassificationDataset

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
/**
 * The method to transform the provided {@link ObjectRankingInstance} to classifier
 * {@link BaselearnerDataset}.A threshold point say t. which is determined by this value t =
 * thresholdPercentage*numberofrankedobjects in an ranking. Then all objects ranked before t are
 * classified as +1 while others as -1.
 * 
 * @param objectRankingInstance the dataset to be transformed
 * @param minimumThresholdRank the minimum threshold rank for which the dataset has to be created
 * @param lambda the lamda value for order-svm for regularizers
 * @return the transformed base learner dataset
 */
public static BaselearnerDataset transformInstanceToOrderedPairwiseClassificationDataset(ObjectRankingInstance objectRankingInstance,
      int minimumThresholdRank, double lambda) {
   int[] objects = objectRankingInstance.getRating().getObjectList();
   int numberOfItemFeatures = objectRankingInstance.getNumofItemFeatures();
   int numberOfContextFeatures = objectRankingInstance.getNumberOfContextsFeatures();
   int totalNumOfObjectFeatures = numberOfItemFeatures + numberOfContextFeatures;
   int numbderOfFeaturesForBaseLearnerDataset = minimumThresholdRank * (totalNumOfObjectFeatures + 1) - 1;
   BaselearnerDataset transformedDataset = new BaselearnerDataset(objects.length * (minimumThresholdRank - 1),
         numbderOfFeaturesForBaseLearnerDataset);
   double[] contextFeatures = objectRankingInstance.getContextFeatureVector();
   double constant = Math.sqrt((lambda * totalNumOfObjectFeatures) / 2);
   for (int thresholdRank = 1; thresholdRank < minimumThresholdRank; thresholdRank++) {
      int rank = 1;
      for (int obj : objects) {
         double classValue = Math.signum((float) thresholdRank - (float) rank);
         if (thresholdRank == rank)
            classValue = 1.0;
         double[] itemFeaturesForObjectOne = objectRankingInstance.getFeaturesForItem(obj);
         double[] feature = ArrayUtils.addAll(contextFeatures, itemFeaturesForObjectOne);
         double[] bias = new double[minimumThresholdRank - 1];
         Arrays.fill(bias, 0.0);
         bias[thresholdRank - 1] = 1;
         double[] vtFeatures = new double[totalNumOfObjectFeatures * (minimumThresholdRank - 1)];
         for (int i = totalNumOfObjectFeatures * (thresholdRank - 1); i < totalNumOfObjectFeatures * thresholdRank; i++) {
            vtFeatures[i] = constant * feature[i - totalNumOfObjectFeatures * (thresholdRank - 1)];
         }
         BaselearnerInstance instance = new BaselearnerInstance(ArrayUtils.addAll(ArrayUtils.addAll(feature, bias), vtFeatures),
               classValue);
         transformedDataset.addInstance(instance);
         rank++;
      }
   }
   return transformedDataset;
}
 
开发者ID:Intelligent-Systems-Group,项目名称:jpl-framework,代码行数:46,代码来源:PairwiseRankingTransformerUtils.java

示例12: getBases

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
/**
 * The base sequence for this path. Pull the full sequence for source nodes and then the suffix for all subsequent nodes
 * @return  non-null sequence of bases corresponding to this path
 */
public byte[] getBases() {
    if( getEdges().isEmpty() ) { return graph.getAdditionalSequence(lastVertex); }

    byte[] bases = graph.getAdditionalSequence(graph.getEdgeSource(edgesInOrder.get(0)));
    for( final E e : edgesInOrder ) {
        bases = ArrayUtils.addAll(bases, graph.getAdditionalSequence(graph.getEdgeTarget(e)));
    }
    return bases;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:14,代码来源:Path.java

示例13: checkAdditionalProperties

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
private void checkAdditionalProperties() {
	if (!additionalPropertiesLoaded) {
		checkLocalProperties();
		if (additionalBeanClass != null) {
try {
	properties = (PropertyDescriptor[]) ArrayUtils.addAll(properties, CachedIntrospector
			.getBeanInfo(additionalBeanClass).getPropertyDescriptors());
} catch (IntrospectionException e) {
}
		}
		additionalPropertiesLoaded = true;
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:14,代码来源:MySimpleBeanInfo.java

示例14: getIncompatibleVersionChanges

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
@Override
public OperatorVersion[] getIncompatibleVersionChanges() {
	return (OperatorVersion[]) ArrayUtils.addAll(super.getIncompatibleVersionChanges(), new OperatorVersion[] {
			VERSION_5_1_6, VERSION_5_2_8, VERSION_6_0_6 });
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:6,代码来源:AggregationOperator.java

示例15: getAllMethods

import org.apache.commons.lang.ArrayUtils; //导入方法依赖的package包/类
public static Method[] getAllMethods(Class<?> aClass) {
    return (Method[]) ArrayUtils.addAll(aClass.getMethods(), aClass.getDeclaredMethods());
}
 
开发者ID:EntryPointKR,项目名称:MCLibrary,代码行数:4,代码来源:Reflections.java


注:本文中的org.apache.commons.lang.ArrayUtils.addAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。