• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 package org.apache.commons.math3;
18 
19 /**
20  * Interface representing a <a href="http://mathworld.wolfram.com/Field.html">field</a>.
21  * <p>
22  * Classes implementing this interface will often be singletons.
23  * </p>
24  * @param <T> the type of the field elements
25  * @see FieldElement
26  * @since 2.0
27  */
28 public interface Field<T> {
29 
30     /** Get the additive identity of the field.
31      * <p>
32      * The additive identity is the element e<sub>0</sub> of the field such that
33      * for all elements a of the field, the equalities a + e<sub>0</sub> =
34      * e<sub>0</sub> + a = a hold.
35      * </p>
36      * @return additive identity of the field
37      */
getZero()38     T getZero();
39 
40     /** Get the multiplicative identity of the field.
41      * <p>
42      * The multiplicative identity is the element e<sub>1</sub> of the field such that
43      * for all elements a of the field, the equalities a &times; e<sub>1</sub> =
44      * e<sub>1</sub> &times; a = a hold.
45      * </p>
46      * @return multiplicative identity of the field
47      */
getOne()48     T getOne();
49 
50     /**
51      * Returns the runtime class of the FieldElement.
52      *
53      * @return The {@code Class} object that represents the runtime
54      *         class of this object.
55      */
getRuntimeClass()56     Class<? extends FieldElement<T>> getRuntimeClass();
57 
58 }
59