TiffRational

Inheritance: java.lang.Object

public class TiffRational

The tiff rational type.

Constructors

ConstructorDescription
TiffRational()Initializes a new instance of the TiffRational class.
TiffRational(long value)Initializes a new instance of the TiffRational class.
TiffRational(long nominator, long denominator)Initializes a new instance of the TiffRational class.

Fields

FieldDescription
EPSILONThe epsilon for fraction calculation

Methods

MethodDescription
approximateFraction(double value, double epsilon)Approximates the provided value to a fraction.
approximateFraction(double value)Approximates the provided value to a fraction.
approximateFraction(float value, double epsilon)Approximates the provided value to a fraction.
approximateFraction(float value)Approximates the provided value to a fraction.
getDenominator()Gets the denominator.
getNominator()Gets the nominator.
getValue()Gets the float value.
getValueD()Gets the double value.
toString()Converts to string.
equals(Object obj)Determines whether the specified Object, is equal to this instance.
hashCode()Returns a hash code for this instance.

TiffRational()

public TiffRational()

Initializes a new instance of the TiffRational class.

TiffRational(long value)

public TiffRational(long value)

Initializes a new instance of the TiffRational class.

Parameters:

ParameterTypeDescription
valuelongThe nominator value.

The nominator will be used as the value specified and denominator will be equal 1. |

TiffRational(long nominator, long denominator)

public TiffRational(long nominator, long denominator)

Initializes a new instance of the TiffRational class.

Parameters:

ParameterTypeDescription
nominatorlongThe nominator.
denominatorlongThe denominator.

EPSILON

public static final double EPSILON

The epsilon for fraction calculation

approximateFraction(double value, double epsilon)

public static TiffRational approximateFraction(double value, double epsilon)

Approximates the provided value to a fraction.

Parameters:

ParameterTypeDescription
valuedoubleThe value.
epsilondoubleThe error allowed.

Returns: TiffRational - A rational number having error less than epsilon.

approximateFraction(double value)

public static TiffRational approximateFraction(double value)

Approximates the provided value to a fraction.

Parameters:

ParameterTypeDescription
valuedoubleThe value.

Returns: TiffRational - A rational number having error less than Epsilon.

approximateFraction(float value, double epsilon)

public static TiffRational approximateFraction(float value, double epsilon)

Approximates the provided value to a fraction.

Parameters:

ParameterTypeDescription
valuefloatThe value.
epsilondoubleThe error allowed.

Returns: TiffRational - A rational number having error less than epsilon.

approximateFraction(float value)

public static TiffRational approximateFraction(float value)

Approximates the provided value to a fraction.

Parameters:

ParameterTypeDescription
valuefloatThe value.

Returns: TiffRational - A rational number having error less than Epsilon.

getDenominator()

public long getDenominator()

Gets the denominator.

Value: The denominator.

Returns: long

getNominator()

public long getNominator()

Gets the nominator.

Value: The nominator.

Returns: long

getValue()

public float getValue()

Gets the float value.

Value: The float value.

Returns: float

getValueD()

public double getValueD()

Gets the double value.

Value: The double value.

Returns: double

toString()

public String toString()

Converts to string.

Returns: java.lang.String - A String that represents this instance.

equals(Object obj)

public boolean equals(Object obj)

Determines whether the specified Object, is equal to this instance.

Parameters:

ParameterTypeDescription
objjava.lang.ObjectThe Object to compare with this instance.

Returns: boolean - true if the specified Object is equal to this instance; otherwise, false.

hashCode()

public int hashCode()

Returns a hash code for this instance.

Returns: int - A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.