Constructor and Description |
---|
SRational(int numerator,
int denominator)
Initializes a new instance of the
SRational class. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Indicates whether the current object is equal to another object of the same type.
|
boolean |
equals(SRational other)
Indicates whether the current object is equal to another object of the same type.
|
static boolean |
equals(SRational rational,
SRational other)
Compares pair of
SRational . |
int |
getDenominator()
Gets denominator.
|
int |
getNumerator()
Gets numerator.
|
double |
getValue()
Gets actual value represented as double.
|
int |
hashCode()
Returns a hash code for this instance.
|
String |
toString()
Returns a
System.String that represents this instance. |
public SRational(int numerator, int denominator)
Initializes a new instance of the SRational
class.
numerator
- The numerator.denominator
- The denominator.ArgumentOutOfRangeException
- denominator;Denominator should be grater then zeropublic final int getNumerator()
Gets numerator.
public final int getDenominator()
Gets denominator.
public final double getValue()
Gets actual value represented as double.
public static boolean equals(SRational rational, SRational other)
Compares pair of SRational
.
rational
- Comparing item.other
- Other item.true
if objects are equal; otherwise false
.public final boolean equals(SRational other)
Indicates whether the current object is equal to another object of the same type.
other
- An object to compare with this object.true
if the current object is equal to the other
parameter; otherwise, false
.public boolean equals(Object obj)
Indicates whether the current object is equal to another object of the same type.
public int hashCode()
Returns a hash code for this instance.
Copyright © 2019. All rights reserved.