View Javadoc
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   * @version $Id: Field.java 1416643 2012-12-03 19:37:14Z tn $
27   * @since 2.0
28   */
29  public interface Field<T> {
30  
31      /** Get the additive identity of the field.
32       * <p>
33       * The additive identity is the element e<sub>0</sub> of the field such that
34       * for all elements a of the field, the equalities a + e<sub>0</sub> =
35       * e<sub>0</sub> + a = a hold.
36       * </p>
37       * @return additive identity of the field
38       */
39      T getZero();
40  
41      /** Get the multiplicative identity of the field.
42       * <p>
43       * The multiplicative identity is the element e<sub>1</sub> of the field such that
44       * for all elements a of the field, the equalities a &times; e<sub>1</sub> =
45       * e<sub>1</sub> &times; a = a hold.
46       * </p>
47       * @return multiplicative identity of the field
48       */
49      T getOne();
50  
51      /**
52       * Returns the runtime class of the FieldElement.
53       *
54       * @return The {@code Class} object that represents the runtime
55       *         class of this object.
56       */
57      Class<? extends FieldElement<T>> getRuntimeClass();
58  
59  }