org.apache.commons.math3.fraction
Class FractionField

java.lang.Object
  extended by org.apache.commons.math3.fraction.FractionField
All Implemented Interfaces:
Serializable, Field<Fraction>

public class FractionField
extends Object
implements Field<Fraction>, Serializable

Representation of the fractional numbers field.

This class is a singleton.

Since:
2.0
Version:
$Id: FractionField.java 1416643 2012-12-03 19:37:14Z tn $
See Also:
Fraction, Serialized Form

Nested Class Summary
private static class FractionField.LazyHolder
          Holder for the instance.
 
Field Summary
private static long serialVersionUID
          Serializable version identifier
 
Constructor Summary
private FractionField()
          Private constructor for the singleton.
 
Method Summary
static FractionField getInstance()
          Get the unique instance.
 Fraction getOne()
          Get the multiplicative identity of the field.
 Class<? extends FieldElement<Fraction>> getRuntimeClass()
          Returns the runtime class of the FieldElement.
 Fraction getZero()
          Get the additive identity of the field.
private  Object readResolve()
          Handle deserialization of the singleton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serializable version identifier

See Also:
Constant Field Values
Constructor Detail

FractionField

private FractionField()
Private constructor for the singleton.

Method Detail

getInstance

public static FractionField getInstance()
Get the unique instance.

Returns:
the unique instance

getOne

public Fraction getOne()
Get the multiplicative identity of the field.

The multiplicative identity is the element e1 of the field such that for all elements a of the field, the equalities a × e1 = e1 × a = a hold.

Specified by:
getOne in interface Field<Fraction>
Returns:
multiplicative identity of the field

getZero

public Fraction getZero()
Get the additive identity of the field.

The additive identity is the element e0 of the field such that for all elements a of the field, the equalities a + e0 = e0 + a = a hold.

Specified by:
getZero in interface Field<Fraction>
Returns:
additive identity of the field

getRuntimeClass

public Class<? extends FieldElement<Fraction>> getRuntimeClass()
Returns the runtime class of the FieldElement.

Specified by:
getRuntimeClass in interface Field<Fraction>
Returns:
The Class object that represents the runtime class of this object.

readResolve

private Object readResolve()
Handle deserialization of the singleton.

Returns:
the singleton instance


Copyright (c) 2003-2013 Apache Software Foundation