MATH-438
Removed deprecated class. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1034564 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f3d957dfbe
commit
a605274077
|
@ -1,214 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.commons.math;
|
||||
|
||||
import org.apache.commons.math.exception.util.DummyLocalizable;
|
||||
import org.apache.commons.math.exception.util.Localizable;
|
||||
import org.apache.commons.math.exception.util.LocalizedFormats;
|
||||
import org.apache.commons.math.linear.ArrayRealVector;
|
||||
|
||||
/**
|
||||
* Exception thrown when an error occurs evaluating a function.
|
||||
* <p>
|
||||
* Maintains an <code>argument</code> property holding the input value that
|
||||
* caused the function evaluation to fail.
|
||||
*
|
||||
* @version $Revision$ $Date$
|
||||
* @deprecated in 2.2 (to be removed in 3.0). Please use
|
||||
* {@link org.apache.commons.math.exception.FunctionEvaluationException} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public class FunctionEvaluationException extends MathException {
|
||||
|
||||
/** Serializable version identifier. */
|
||||
private static final long serialVersionUID = 1384427981840836868L;
|
||||
|
||||
/** Argument causing function evaluation failure */
|
||||
private double[] argument;
|
||||
|
||||
/**
|
||||
* Construct an exception indicating the argument value
|
||||
* that caused the function evaluation to fail.
|
||||
*
|
||||
* @param argument the failing function argument
|
||||
*/
|
||||
public FunctionEvaluationException(double argument) {
|
||||
super(LocalizedFormats.EVALUATION_FAILED, argument);
|
||||
this.argument = new double[] { argument };
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an exception indicating the argument value
|
||||
* that caused the function evaluation to fail.
|
||||
*
|
||||
* @param argument the failing function argument
|
||||
* @since 2.0
|
||||
*/
|
||||
public FunctionEvaluationException(double[] argument) {
|
||||
super(LocalizedFormats.EVALUATION_FAILED, new ArrayRealVector(argument));
|
||||
this.argument = argument.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an exception with specified formatted detail message.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
* @param argument the failing function argument
|
||||
* @param pattern format specifier
|
||||
* @param arguments format arguments
|
||||
* @since 1.2
|
||||
*/
|
||||
public FunctionEvaluationException(double argument,
|
||||
String pattern, Object ... arguments) {
|
||||
this(argument, new DummyLocalizable(pattern), arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an exception with specified formatted detail message.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
* @param argument the failing function argument
|
||||
* @param pattern format specifier
|
||||
* @param arguments format arguments
|
||||
* @since 2.2
|
||||
*/
|
||||
public FunctionEvaluationException(double argument,
|
||||
Localizable pattern, Object ... arguments) {
|
||||
super(pattern, arguments);
|
||||
this.argument = new double[] { argument };
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an exception with specified formatted detail message.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
* @param argument the failing function argument
|
||||
* @param pattern format specifier
|
||||
* @param arguments format arguments
|
||||
* @since 2.0
|
||||
*/
|
||||
public FunctionEvaluationException(double[] argument,
|
||||
String pattern, Object ... arguments) {
|
||||
this(argument, new DummyLocalizable(pattern), arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an exception with specified formatted detail message.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
* @param argument the failing function argument
|
||||
* @param pattern format specifier
|
||||
* @param arguments format arguments
|
||||
* @since 2.2
|
||||
*/
|
||||
public FunctionEvaluationException(double[] argument,
|
||||
Localizable pattern, Object ... arguments) {
|
||||
super(pattern, arguments);
|
||||
this.argument = argument.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an exception with specified root cause.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
* @param cause the exception or error that caused this exception to be thrown
|
||||
* @param argument the failing function argument
|
||||
* @since 1.2
|
||||
*/
|
||||
public FunctionEvaluationException(Throwable cause, double argument) {
|
||||
super(cause);
|
||||
this.argument = new double[] { argument };
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an exception with specified root cause.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
* @param cause the exception or error that caused this exception to be thrown
|
||||
* @param argument the failing function argument
|
||||
* @since 2.0
|
||||
*/
|
||||
public FunctionEvaluationException(Throwable cause, double[] argument) {
|
||||
super(cause);
|
||||
this.argument = argument.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an exception with specified formatted detail message and root cause.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
* @param cause the exception or error that caused this exception to be thrown
|
||||
* @param argument the failing function argument
|
||||
* @param pattern format specifier
|
||||
* @param arguments format arguments
|
||||
* @since 1.2
|
||||
*/
|
||||
public FunctionEvaluationException(Throwable cause,
|
||||
double argument, String pattern,
|
||||
Object ... arguments) {
|
||||
this(cause, argument, new DummyLocalizable(pattern), arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an exception with specified formatted detail message and root cause.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
* @param cause the exception or error that caused this exception to be thrown
|
||||
* @param argument the failing function argument
|
||||
* @param pattern format specifier
|
||||
* @param arguments format arguments
|
||||
* @since 2.2
|
||||
*/
|
||||
public FunctionEvaluationException(Throwable cause,
|
||||
double argument, Localizable pattern,
|
||||
Object ... arguments) {
|
||||
super(cause, pattern, arguments);
|
||||
this.argument = new double[] { argument };
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an exception with specified formatted detail message and root cause.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
* @param cause the exception or error that caused this exception to be thrown
|
||||
* @param argument the failing function argument
|
||||
* @param pattern format specifier
|
||||
* @param arguments format arguments
|
||||
* @since 2.0
|
||||
*/
|
||||
public FunctionEvaluationException(Throwable cause,
|
||||
double[] argument, String pattern,
|
||||
Object ... arguments) {
|
||||
this(cause, argument, new DummyLocalizable(pattern), arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an exception with specified formatted detail message and root cause.
|
||||
* Message formatting is delegated to {@link java.text.MessageFormat}.
|
||||
* @param cause the exception or error that caused this exception to be thrown
|
||||
* @param argument the failing function argument
|
||||
* @param pattern format specifier
|
||||
* @param arguments format arguments
|
||||
* @since 2.2
|
||||
*/
|
||||
public FunctionEvaluationException(Throwable cause,
|
||||
double[] argument, Localizable pattern,
|
||||
Object ... arguments) {
|
||||
super(cause, pattern, arguments);
|
||||
this.argument = argument.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the function argument that caused this exception.
|
||||
*
|
||||
* @return argument that caused function evaluation to fail
|
||||
*/
|
||||
public double[] getArgument() {
|
||||
return argument.clone();
|
||||
}
|
||||
}
|
|
@ -52,6 +52,10 @@ The <action> type attribute can be add,update,fix,remove.
|
|||
If the output is not quite correct, check for invisible trailing spaces!
|
||||
-->
|
||||
<release version="3.0" date="TBD" description="TBD">
|
||||
<action dev="erans" type="update" issue="MATH-440">
|
||||
Removed classes "FunctionEvaluationException", "MatrixVisitorException"
|
||||
and "DerivativeException" (superseded by the new "MathUserException").
|
||||
</action>
|
||||
<action dev="erans" type="fix" issue="MATH-432">
|
||||
Created a generic "Pair" class to replace the "AbstractMap.SimpleEntry"
|
||||
that is only available in Java 6 and later.
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.commons.math;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.math.exception.util.LocalizedFormats;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @version $Revision$ $Date$
|
||||
*/
|
||||
public class FunctionEvaluationExceptionTest extends TestCase {
|
||||
|
||||
public void testConstructor(){
|
||||
FunctionEvaluationException ex = new FunctionEvaluationException(0.0);
|
||||
assertNull(ex.getCause());
|
||||
assertNotNull(ex.getMessage());
|
||||
assertTrue(ex.getMessage().indexOf("0") > 0);
|
||||
assertEquals(0.0, ex.getArgument()[0], 0);
|
||||
}
|
||||
|
||||
public void testConstructorArray(){
|
||||
FunctionEvaluationException ex =
|
||||
new FunctionEvaluationException(new double[] { 0, 1, 2 });
|
||||
assertNull(ex.getCause());
|
||||
assertNotNull(ex.getMessage());
|
||||
assertTrue(ex.getMessage().indexOf("0") > 0);
|
||||
assertEquals(0.0, ex.getArgument()[0], 0);
|
||||
assertEquals(1.0, ex.getArgument()[1], 0);
|
||||
assertEquals(2.0, ex.getArgument()[2], 0);
|
||||
}
|
||||
|
||||
public void testConstructorPatternArguments(){
|
||||
LocalizedFormats pattern = LocalizedFormats.EVALUATION_FAILED;
|
||||
Object[] arguments = { Double.valueOf(0.0) };
|
||||
FunctionEvaluationException ex = new FunctionEvaluationException(0.0, pattern, arguments);
|
||||
assertNull(ex.getCause());
|
||||
assertEquals(pattern, ex.getLocalizablePattern());
|
||||
assertEquals(arguments.length, ex.getArguments().length);
|
||||
for (int i = 0; i < arguments.length; ++i) {
|
||||
assertEquals(arguments[i], ex.getArguments()[i]);
|
||||
}
|
||||
assertFalse(pattern.equals(ex.getMessage()));
|
||||
assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
|
||||
}
|
||||
|
||||
public void testConstructorArrayPatternArguments(){
|
||||
LocalizedFormats pattern = LocalizedFormats.EVALUATION_FAILED;
|
||||
Object[] arguments = { Double.valueOf(0.0) };
|
||||
FunctionEvaluationException ex =
|
||||
new FunctionEvaluationException(new double[] { 0, 1, 2 }, pattern, arguments);
|
||||
assertNull(ex.getCause());
|
||||
assertEquals(pattern, ex.getLocalizablePattern());
|
||||
assertEquals(arguments.length, ex.getArguments().length);
|
||||
for (int i = 0; i < arguments.length; ++i) {
|
||||
assertEquals(arguments[i], ex.getArguments()[i]);
|
||||
}
|
||||
assertFalse(pattern.equals(ex.getMessage()));
|
||||
assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
|
||||
assertEquals(0.0, ex.getArgument()[0], 0);
|
||||
assertEquals(1.0, ex.getArgument()[1], 0);
|
||||
assertEquals(2.0, ex.getArgument()[2], 0);
|
||||
}
|
||||
|
||||
public void testConstructorPatternArgumentsCause(){
|
||||
LocalizedFormats pattern = LocalizedFormats.EVALUATION_FAILED;
|
||||
Object[] arguments = { Double.valueOf(0.0) };
|
||||
String inMsg = "inner message";
|
||||
Exception cause = new Exception(inMsg);
|
||||
FunctionEvaluationException ex = new FunctionEvaluationException(cause, 0.0, pattern, arguments);
|
||||
assertEquals(cause, ex.getCause());
|
||||
assertEquals(pattern, ex.getLocalizablePattern());
|
||||
assertEquals(arguments.length, ex.getArguments().length);
|
||||
for (int i = 0; i < arguments.length; ++i) {
|
||||
assertEquals(arguments[i], ex.getArguments()[i]);
|
||||
}
|
||||
assertFalse(pattern.equals(ex.getMessage()));
|
||||
assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
|
||||
}
|
||||
|
||||
public void testConstructorArrayPatternArgumentsCause(){
|
||||
LocalizedFormats pattern = LocalizedFormats.EVALUATION_FAILED;
|
||||
Object[] arguments = { Double.valueOf(0.0) };
|
||||
String inMsg = "inner message";
|
||||
Exception cause = new Exception(inMsg);
|
||||
FunctionEvaluationException ex =
|
||||
new FunctionEvaluationException(cause, new double[] { 0, 1, 2 }, pattern, arguments);
|
||||
assertEquals(cause, ex.getCause());
|
||||
assertEquals(pattern, ex.getLocalizablePattern());
|
||||
assertEquals(arguments.length, ex.getArguments().length);
|
||||
for (int i = 0; i < arguments.length; ++i) {
|
||||
assertEquals(arguments[i], ex.getArguments()[i]);
|
||||
}
|
||||
assertFalse(pattern.equals(ex.getMessage()));
|
||||
assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
|
||||
assertEquals(0.0, ex.getArgument()[0], 0);
|
||||
assertEquals(1.0, ex.getArgument()[1], 0);
|
||||
assertEquals(2.0, ex.getArgument()[2], 0);
|
||||
}
|
||||
|
||||
public void testConstructorArgumentCause(){
|
||||
String inMsg = "inner message";
|
||||
Exception cause = new Exception(inMsg);
|
||||
FunctionEvaluationException ex = new FunctionEvaluationException(cause, 0.0);
|
||||
assertEquals(cause, ex.getCause());
|
||||
assertTrue(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
|
||||
}
|
||||
|
||||
public void testConstructorArrayArgumentCause(){
|
||||
String inMsg = "inner message";
|
||||
Exception cause = new Exception(inMsg);
|
||||
FunctionEvaluationException ex =
|
||||
new FunctionEvaluationException(cause, new double[] { 0, 1, 2 });
|
||||
assertEquals(cause, ex.getCause());
|
||||
assertTrue(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
|
||||
assertEquals(0.0, ex.getArgument()[0], 0);
|
||||
assertEquals(1.0, ex.getArgument()[1], 0);
|
||||
assertEquals(2.0, ex.getArgument()[2], 0);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue