FileDocCategorySizeDatePackage
Rational.javaAPI DocAndroid 5.1 API2296Thu Mar 12 22:22:42 GMT 2015com.android.gallery3d.exif

Rational

public class Rational extends Object
The rational data type of EXIF tag. Contains a pair of longs representing the numerator and denominator of a Rational number.

Fields Summary
private final long
mNumerator
private final long
mDenominator
Constructors Summary
public Rational(long nominator, long denominator)
Create a Rational with a given numerator and denominator.

param
nominator
param
denominator

        mNumerator = nominator;
        mDenominator = denominator;
    
public Rational(Rational r)
Create a copy of a Rational.

        mNumerator = r.mNumerator;
        mDenominator = r.mDenominator;
    
Methods Summary
public booleanequals(java.lang.Object obj)

        if (obj == null) {
            return false;
        }
        if (this == obj) {
            return true;
        }
        if (obj instanceof Rational) {
            Rational data = (Rational) obj;
            return mNumerator == data.mNumerator && mDenominator == data.mDenominator;
        }
        return false;
    
public longgetDenominator()
Gets the denominator of the rational

        return mDenominator;
    
public longgetNumerator()
Gets the numerator of the rational.

        return mNumerator;
    
public doubletoDouble()
Gets the rational value as type double. Will cause a divide-by-zero error if the denominator is 0.

        return mNumerator / (double) mDenominator;
    
public java.lang.StringtoString()

        return mNumerator + "/" + mDenominator;