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


Java Localizable类代码示例

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


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

示例1: checkValidity

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
@Override
protected void checkValidity(List<Integer> chromosomeRepresentation) throws InvalidRepresentationException {
	if(chromosomeRepresentation.size()!=18) throw new InvalidRepresentationException(new Localizable() {
		
		@Override
		public String getSourceString() {
			return "The chromosome must have exactly 18 gens. It currently have "+chromosomeRepresentation.size();
		}
		
		@Override
		public String getLocalizedString(Locale locale) {
			return this.getSourceString();
		}
	});
}
 
开发者ID:gDanix,项目名称:Genetic-Ingress-Attack-Optimizer,代码行数:16,代码来源:XMPChromosome.java

示例2: MathIllegalStateException

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/**
 * Simple constructor.
 *
 * @param cause Root cause.
 * @param pattern Message pattern explaining the cause of the error.
 * @param args Arguments.
 */
public MathIllegalStateException(Throwable cause,
                                 Localizable pattern,
                                 Object ... args) {
    super(cause);
    context = new ExceptionContext(this);
    context.addMessage(pattern, args);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:15,代码来源:MathIllegalStateException.java

示例3: NumberIsTooLargeException

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/**
 * Construct the exception with a specific context.
 *
 * @param specific Specific context pattern.
 * @param wrong Value that is larger than the maximum.
 * @param max Maximum.
 * @param boundIsAllowed if true the maximum is included in the allowed range.
 */
public NumberIsTooLargeException(Localizable specific,
                                 Number wrong,
                                 Number max,
                                 boolean boundIsAllowed) {
    super(specific, wrong, max);

    this.max = max;
    this.boundIsAllowed = boundIsAllowed;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:18,代码来源:NumberIsTooLargeException.java

示例4: NumberIsTooSmallException

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/**
 * Construct the exception with a specific context.
 *
 * @param specific Specific context pattern.
 * @param wrong Value that is smaller than the minimum.
 * @param min Minimum.
 * @param boundIsAllowed Whether {@code min} is included in the allowed range.
 */
public NumberIsTooSmallException(Localizable specific,
                                 Number wrong,
                                 Number min,
                                 boolean boundIsAllowed) {
    super(specific, wrong, min);

    this.min = min;
    this.boundIsAllowed = boundIsAllowed;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:18,代码来源:NumberIsTooSmallException.java

示例5: NoBracketingException

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/**
 * Construct the exception with a specific context.
 *
 * @param specific Contextual information on what caused the exception.
 * @param lo Lower end of the interval.
 * @param hi Higher end of the interval.
 * @param fLo Value at lower end of the interval.
 * @param fHi Value at higher end of the interval.
 * @param args Additional arguments.
 */
public NoBracketingException(Localizable specific,
                             double lo, double hi,
                             double fLo, double fHi,
                             Object ... args) {
    super(specific, Double.valueOf(lo), Double.valueOf(hi), Double.valueOf(fLo), Double.valueOf(fHi), args);
    this.lo = lo;
    this.hi = hi;
    this.fLo = fLo;
    this.fHi = fHi;
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:21,代码来源:NoBracketingException.java

示例6: checkNotNull

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/**
 * Checks that an object is not null.
 *
 * @param o Object to be checked.
 * @param pattern Message pattern.
 * @param args Arguments to replace the placeholders in {@code pattern}.
 * @throws NullArgumentException if {@code o} is {@code null}.
 */
public static void checkNotNull(Object o,
                                Localizable pattern,
                                Object ... args)
    throws NullArgumentException {
    if (o == null) {
        throw new NullArgumentException(pattern, args);
    }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:17,代码来源:MathUtils.java

示例7: NoBracketingException

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/**
 * Construct the exception with a specific context.
 *
 * @param specific Contextual information on what caused the exception.
 * @param lo Lower end of the interval.
 * @param hi Higher end of the interval.
 * @param fLo Value at lower end of the interval.
 * @param fHi Value at higher end of the interval.
 * @param args Additional arguments.
 */
public NoBracketingException(Localizable specific,
                             double lo, double hi,
                             double fLo, double fHi,
                             Object ... args) {
    super(specific, lo, hi, fLo, fHi, args);
    this.lo = lo;
    this.hi = hi;
    this.fLo = fLo;
    this.fHi = fHi;
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:21,代码来源:NoBracketingException.java

示例8: addAndCheck

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/**
 * Add two long integers, checking for overflow.
 *
 * @param a Addend.
 * @param b Addend.
 * @param pattern Pattern to use for any thrown exception.
 * @return the sum {@code a + b}.
 * @throws MathArithmeticException if the result cannot be represented
 * as a {@code long}.
 * @since 1.2
 */
 private static long addAndCheck(long a, long b, Localizable pattern) {
    long ret;
    if (a > b) {
        // use symmetry to reduce boundary cases
        ret = addAndCheck(b, a, pattern);
    } else {
        // assert a <= b

        if (a < 0) {
            if (b < 0) {
                // check for negative overflow
                if (Long.MIN_VALUE - b <= a) {
                    ret = a + b;
                } else {
                    throw new MathArithmeticException(pattern, a, b);
                }
            } else {
                // opposite sign addition is always safe
                ret = a + b;
            }
        } else {
            // assert a >= 0
            // assert b >= 0

            // check for positive overflow
            if (a <= Long.MAX_VALUE - b) {
                ret = a + b;
            } else {
                throw new MathArithmeticException(pattern, a, b);
            }
        }
    }
    return ret;
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:46,代码来源:ArithmeticUtils.java

示例9: RuggedException

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/** Simple constructor.
 * Build an exception from a cause and with a specified message
 * @param message descriptive message
 * @param cause underlying cause
 */
public RuggedException(final Localizable message, final Throwable cause) {
    super(cause);
    this.context   = null;
    this.specifier = message;
    this.parts     = new Object[0];
}
 
开发者ID:CS-SI,项目名称:Rugged,代码行数:12,代码来源:RuggedException.java

示例10: createInternalError

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/** Create an {@link java.lang.RuntimeException} for an internal error.
 * @param cause underlying cause
 * @return an {@link java.lang.RuntimeException} for an internal error
 */
public static RuntimeException createInternalError(final Throwable cause) {

    /** Format specifier (to be translated). */
    final Localizable specifier = RuggedMessages.INTERNAL_ERROR;

    /** Parts to insert in the format (no translation). */
    final String parts     = "[email protected]";

    return new RuntimeException() {

        /** Serializable UID. */
        private static final long serialVersionUID = 20140309L;

        /** {@inheritDoc} */
        @Override
        public String getMessage() {
            return buildMessage(Locale.US, specifier, parts);
        }

        /** {@inheritDoc} */
        @Override
        public String getLocalizedMessage() {
            return buildMessage(Locale.getDefault(), specifier, parts);
        }

    };

}
 
开发者ID:CS-SI,项目名称:Rugged,代码行数:33,代码来源:RuggedException.java

示例11: of

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
private static Localizable of(String string) {
    return new Localizable() {
        @Override
        public String getSourceString() {
            return string;
        }

        @Override
        public String getLocalizedString(Locale locale) {
            return string;
        }
    };
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:14,代码来源:MatrixUtil.java

示例12: MathIllegalArgumentException

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/**
 * @param pattern Message pattern explaining the cause of the error.
 * @param args Arguments.
 */
public MathIllegalArgumentException(Localizable pattern,
                                    Object ... args) {
    context = new ExceptionContext(this);
    context.addMessage(pattern, args);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:10,代码来源:MathIllegalArgumentException.java

示例13: MathUnsupportedOperationException

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/**
 * @param pattern Message pattern providing the specific context of
 * the error.
 * @param args Arguments.
 */
public MathUnsupportedOperationException(Localizable pattern,
                                         Object ... args) {
    context = new ExceptionContext(this);
    context.addMessage(pattern, args);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:11,代码来源:MathUnsupportedOperationException.java

示例14: MathRuntimeException

import org.apache.commons.math3.exception.util.Localizable; //导入依赖的package包/类
/**
 * @param pattern Message pattern explaining the cause of the error.
 * @param args Arguments.
 */
public MathRuntimeException(Localizable pattern,
                            Object ... args) {
    context = new ExceptionContext(this);
    context.addMessage(pattern, args);
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:10,代码来源:MathRuntimeException.java


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