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


Java LocalizedFormats.TOO_MANY_ELEMENTS_TO_DISCARD_FROM_ARRAY属性代码示例

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


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

示例1: discardExtremeElements

/**
 * Discards the <code>i</code> first or last elements of the array,
 * depending on the value of <code>front</code>.
 * For example, if the array contains the elements 1,2,3,4, invoking
 * <code>discardExtremeElements(2,false)</code> will cause the last two elements
 * to be discarded, leaving 1,2 in the array.
 * For example, if the array contains the elements 1,2,3,4, invoking
 * <code>discardExtremeElements(2,true)</code> will cause the first two elements
 * to be discarded, leaving 3,4 in the array.
 * Throws illegalArgumentException
 * if i exceeds numElements.
 *
 * @param i  the number of elements to discard from the front/end of the array
 * @param front true if elements are to be discarded from the front
 * of the array, false if elements are to be discarded from the end
 * of the array
 * @throws MathIllegalArgumentException if i is greater than numElements.
 * @since 2.0
 */
private synchronized void discardExtremeElements(int i,
                                                 boolean front)
    throws MathIllegalArgumentException {
    if (i > numElements) {
        throw new MathIllegalArgumentException(
                LocalizedFormats.TOO_MANY_ELEMENTS_TO_DISCARD_FROM_ARRAY,
                i, numElements);
   } else if (i < 0) {
       throw new MathIllegalArgumentException(
               LocalizedFormats.CANNOT_DISCARD_NEGATIVE_NUMBER_OF_ELEMENTS,
               i);
    } else {
        // "Subtract" this number of discarded from numElements
        numElements -= i;
        if (front) {
            startIndex += i;
        }
    }
    if (shouldContract()) {
        contract();
    }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:41,代码来源:ResizableDoubleArray.java

示例2: discardExtremeElements

/**
 * Discards the <code>i<code> first or last elements of the array,
 * depending on the value of <code>front</code>.
 * For example, if the array contains the elements 1,2,3,4, invoking
 * <code>discardExtremeElements(2,false)</code> will cause the last two elements
 * to be discarded, leaving 1,2 in the array.
 * For example, if the array contains the elements 1,2,3,4, invoking
 * <code>discardExtremeElements(2,true)</code> will cause the first two elements
 * to be discarded, leaving 3,4 in the array.
 * Throws illegalArgumentException
 * if i exceeds numElements.
 *
 * @param i  the number of elements to discard from the front/end of the array
 * @param front true if elements are to be discarded from the front
 * of the array, false if elements are to be discarded from the end
 * of the array
 * @throws IllegalArgumentException if i is greater than numElements.
 * @since 2.0
 */
private synchronized void discardExtremeElements(int i,boolean front) {
    if (i > numElements) {
        throw new MathIllegalArgumentException(
                LocalizedFormats.TOO_MANY_ELEMENTS_TO_DISCARD_FROM_ARRAY,
                i, numElements);
   } else if (i < 0) {
       throw new MathIllegalArgumentException(
               LocalizedFormats.CANNOT_DISCARD_NEGATIVE_NUMBER_OF_ELEMENTS,
               i);
    } else {
        // "Subtract" this number of discarded from numElements
        numElements -= i;
        if (front) {
            startIndex += i;
        }
    }
    if (shouldContract()) {
        contract();
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:39,代码来源:ResizableDoubleArray.java


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