commons-math3-3.6.1-org.apache.commons.math3.FieldElement<T>-中英对照文档及源码赏析
完整中文文档、中英对照文档下载请移步:commons-math3-中文文档、中英对照文档-CSDN下载
1. 开源组件说明
jar包名称:commons-math3-3.6.1.jar
Maven 依赖:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
完整中文文档、中英对照文档下载请移步:commons-math3-中文文档、中英对照文档-CSDN下载
本文介绍的类名:org.apache.commons.math3.FieldElement<T>
2. FieldElement<T>
中文-英语对照文档
接口 FieldElement<T>
-
-
Type Parameters:
-
T
- the type of the field elements
t - 现场元素的类型
-
All Known Subinterfaces:
-
RealFieldElement<T>
REALFIELDELEMENT
-
All Known Implementing Classes:
-
BigFraction,
BigReal,
Complex,
Decimal64,
DerivativeStructure,
Dfp,
DfpDec,
Fraction,
SparseGradient
Bigflaction,Bigreal,Complex,Decimal64,衍生体,DFP,DFPDEC,分数,稀疏
public interface FieldElement<T>
-
从以下版本开始:
-
2.0
2.0
另请参阅:
-
Field
场地
-
-
-
方法概要
Methods 限定符和类型 方法和说明 T
add(T a)
Compute this + a.
计算这个+ a。
T
divide(T a)
Compute this ÷ a.
计算此÷A。
Field<T>
getField()
T
multiply(int n)
Compute n × this.
计算n×它。
T
multiply(T a)
Compute this × a.
计算此×a。
T
negate()
Returns the additive inverse ofthis
element.
返回此元素的附加逆。
T
reciprocal()
Returns the multiplicative inverse ofthis
element.
返回此元素的乘法倒数。
T
subtract(T a)
Compute this - a.
计算这个 - a。
-
-
-
方法详细说明
add
T add(T a) throws NullArgumentException
Compute this + a.
计算这个+ a。
-
参数:
-
a
- element to add
a - 要添加的元素
返回:
-
a new element representing this + a
代表这个+ a的新元素
抛出:
-
NullArgumentException
- ifa
isnull
.
nullargumentException - 如果a为null。
-
subtract
T subtract(T a) throws NullArgumentException
Compute this - a.
计算这个 - a。
-
参数:
-
a
- element to subtract
a - 要减去的元素
返回:
-
a new element representing this - a
代表这个的新元素 - a
抛出:
-
NullArgumentException
- ifa
isnull
.
nullargumentException - 如果a为null。
-
negate
T negate()
Returns the additive inverse ofthis
element.
返回此元素的附加逆。
-
返回:
-
the opposite of
this
.
与此相反。
-
the opposite of
multiply
T multiply(int n)
Compute n × this. Multiplication by an integer number is defined as the following sumn × this = ∑ i=1 n this.
计算n×它。通过整数数乘法定义为以下和n×这个=Σi= 1n。
-
参数:
-
n
- Number of timesthis
must be added to itself.
n - 必须添加到自身的次数。
返回:
-
A new element representing n × this.
一个表示n×的新元素。
-
multiply
T multiply(T a) throws NullArgumentException
Compute this × a.
计算此×a。
-
参数:
-
a
- element to multiply
一个 - 要乘法的元素
返回:
-
a new element representing this × a
一个代表这个×a的新元素
抛出:
-
NullArgumentException
- ifa
isnull
.
nullargumentException - 如果a为null。
-
divide
T divide(T a) throws NullArgumentException, MathArithmeticException
Compute this ÷ a.
计算此÷A。
-
参数:
-
a
- element to divide by
a - 划分的元素
返回:
-
a new element representing this ÷ a
一个代表这个的新元素
抛出:
-
NullArgumentException
- ifa
isnull
.
nullargumentException - 如果a为null。
-
MathArithmeticException
- ifa
is zero
数学算术例外 - 如果a为零
-
reciprocal
T reciprocal() throws MathArithmeticException
Returns the multiplicative inverse ofthis
element.
返回此元素的乘法倒数。
-
返回:
-
the inverse of
this
.
这方面的反向。
抛出:
-
MathArithmeticException
- ifthis
is zero
数学算术例外 - 如果这是零
-
the inverse of
-
3. 源码赏析
/*
* 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.math3;
import org.apache.commons.math3.exception.MathArithmeticException;
import org.apache.commons.math3.exception.NullArgumentException;
/**
* Interface representing <a href="http://mathworld.wolfram.com/Field.html">field</a> elements.
* @param <T> the type of the field elements
* @see Field
* @since 2.0
*/
public interface FieldElement<T> {
/** Compute this + a.
* @param a element to add
* @return a new element representing this + a
* @throws NullArgumentException if {@code a} is {@code null}.
*/
T add(T a) throws NullArgumentException;
/** Compute this - a.
* @param a element to subtract
* @return a new element representing this - a
* @throws NullArgumentException if {@code a} is {@code null}.
*/
T subtract(T a) throws NullArgumentException;
/**
* Returns the additive inverse of {@code this} element.
* @return the opposite of {@code this}.
*/
T negate();
/** Compute n × this. Multiplication by an integer number is defined
* as the following sum
* <center>
* n × this = ∑<sub>i=1</sub><sup>n</sup> this.
* </center>
* @param n Number of times {@code this} must be added to itself.
* @return A new element representing n × this.
*/
T multiply(int n);
/** Compute this × a.
* @param a element to multiply
* @return a new element representing this × a
* @throws NullArgumentException if {@code a} is {@code null}.
*/
T multiply(T a) throws NullArgumentException;
/** Compute this ÷ a.
* @param a element to divide by
* @return a new element representing this ÷ a
* @throws NullArgumentException if {@code a} is {@code null}.
* @throws MathArithmeticException if {@code a} is zero
*/
T divide(T a) throws NullArgumentException, MathArithmeticException;
/**
* Returns the multiplicative inverse of {@code this} element.
* @return the inverse of {@code this}.
* @throws MathArithmeticException if {@code this} is zero
*/
T reciprocal() throws MathArithmeticException;
/** Get the {@link Field} to which the instance belongs.
* @return {@link Field} to which the instance belongs
*/
Field<T> getField();
}