001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.commons.math3;
018
019/**
020 * Interface representing a <a href="http://mathworld.wolfram.com/Field.html">field</a>.
021 * <p>
022 * Classes implementing this interface will often be singletons.
023 * </p>
024 * @param <T> the type of the field elements
025 * @see FieldElement
026 * @since 2.0
027 */
028public interface Field<T> {
029
030    /** Get the additive identity of the field.
031     * <p>
032     * The additive identity is the element e<sub>0</sub> of the field such that
033     * for all elements a of the field, the equalities a + e<sub>0</sub> =
034     * e<sub>0</sub> + a = a hold.
035     * </p>
036     * @return additive identity of the field
037     */
038    T getZero();
039
040    /** Get the multiplicative identity of the field.
041     * <p>
042     * The multiplicative identity is the element e<sub>1</sub> of the field such that
043     * for all elements a of the field, the equalities a &times; e<sub>1</sub> =
044     * e<sub>1</sub> &times; a = a hold.
045     * </p>
046     * @return multiplicative identity of the field
047     */
048    T getOne();
049
050    /**
051     * Returns the runtime class of the FieldElement.
052     *
053     * @return The {@code Class} object that represents the runtime
054     *         class of this object.
055     */
056    Class<? extends FieldElement<T>> getRuntimeClass();
057
058}