Java Code Examples for org.apache.commons.lang3.ArrayUtils.getLength()

The following are Jave code examples for showing how to use getLength() of the org.apache.commons.lang3.ArrayUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: talchain   File: OlympicConfig.java   View Source Code Vote up 5 votes
@Override
public long getTransactionCost(Transaction tx) {
    long nonZeroes = tx.nonZeroDataBytes();
    long zeroVals  = ArrayUtils.getLength(tx.getData()) - nonZeroes;

    return getGasCost().getTRANSACTION() + zeroVals * getGasCost().getTX_ZERO_DATA() +
            nonZeroes * getGasCost().getTX_NO_ZERO_DATA();
}
 
Example 2
Project: talchain   File: HomesteadConfig.java   View Source Code Vote up 5 votes
@Override
public long getTransactionCost(Transaction tx) {
    long nonZeroes = tx.nonZeroDataBytes();
    long zeroVals  = ArrayUtils.getLength(tx.getData()) - nonZeroes;

    return (tx.isContractCreation() ? getGasCost().getTRANSACTION_CREATE_CONTRACT() : getGasCost().getTRANSACTION())
            + zeroVals * getGasCost().getTX_ZERO_DATA() + nonZeroes * getGasCost().getTX_NO_ZERO_DATA();
}
 
Example 3
Project: rskj   File: Transaction.java   View Source Code Vote up 5 votes
public long transactionCost(RskSystemProperties config, Block block){
      if (!parsed) {
          rlpParse();
      }

// Federators txs to the bridge are free during system setup
      if (BridgeUtils.isFreeBridgeTx(config, this, block.getNumber())) {
          return 0;
      }

      long nonZeroes = this.nonZeroDataBytes();
      long zeroVals  = ArrayUtils.getLength(this.getData()) - nonZeroes;

      return (this.isContractCreation() ? GasCost.TRANSACTION_CREATE_CONTRACT : GasCost.TRANSACTION) + zeroVals * GasCost.TX_ZERO_DATA + nonZeroes * GasCost.TX_NO_ZERO_DATA;
  }
 
Example 4
Project: AppCoins-ethereumj   File: OlympicConfig.java   View Source Code Vote up 5 votes
@Override
public long getTransactionCost(Transaction tx) {
    long nonZeroes = tx.nonZeroDataBytes();
    long zeroVals  = ArrayUtils.getLength(tx.getData()) - nonZeroes;

    return getGasCost().getTRANSACTION() + zeroVals * getGasCost().getTX_ZERO_DATA() +
            nonZeroes * getGasCost().getTX_NO_ZERO_DATA();
}
 
Example 5
Project: AppCoins-ethereumj   File: HomesteadConfig.java   View Source Code Vote up 5 votes
@Override
public long getTransactionCost(Transaction tx) {
    long nonZeroes = tx.nonZeroDataBytes();
    long zeroVals  = ArrayUtils.getLength(tx.getData()) - nonZeroes;

    return (tx.isContractCreation() ? getGasCost().getTRANSACTION_CREATE_CONTRACT() : getGasCost().getTRANSACTION())
            + zeroVals * getGasCost().getTX_ZERO_DATA() + nonZeroes * getGasCost().getTX_NO_ZERO_DATA();
}
 
Example 6
Project: jvm-sandbox   File: ModuleHttpServlet.java   View Source Code Vote up 3 votes
/**
 * 提取模块ID
 * 模块ID应该在PATH的第一个位置
 *
 * @param path servlet访问路径
 * @return 路径解析成功则返回模块的ID,如果解析失败则返回null
 */
private String parseUniqueId(final String path) {
    final String[] pathSegmentArray = StringUtils.split(path, "/");
    return ArrayUtils.getLength(pathSegmentArray) >= 1
            ? pathSegmentArray[0]
            : null;
}