The IPair class provides generic ordered pairs of coordinates. The class serves as the base for the following specific ordered-pair classes:
This class provides basic utilities to get and set the two coordinate values. In addition, it provides a full set of comparison and mathematical operators to manipulate ordered pairs.
You can construct, copy, and assign objects of this class. This class uses the compiler-generated copy constructor and assignment operator to copy and assign IPair objects.
![]() |
public:
IPair(Coord coord1, Coord coord2)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IPair()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IPair(Coord init)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to compare one IPair object to another.
![]() |
public:
bool operator !=(const IPair& aPair) const
True if either coordinate differs.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
bool operator <(const IPair& aPair) const
True if both coordinates are less than those of the specified aPair.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
bool operator <=(const IPair& aPair) const
True if both coordinates are less than or equal.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
bool operator ==(const IPair& aPair) const
True if both coordinates match those of the specified aPair.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
bool operator >(const IPair& aPair) const
True if both coordinates are greater than those of the specified aPair.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
bool operator >=(const IPair& aPair) const
True if both coordinates are greater than or equal.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to return an IPair object in a different form.
![]() |
public:
IString asDebugInfo() const
Converts the ordered pair to an IString containing a diagnostic representation of the object.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IString asString() const
Converts the ordered pair (a, b) to an IString( "(a, b)" ).
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IPair operator -() const
Returns an ordered pair whose coordinates are the difference between the corresponding coordinates of pair1 and pair2.
When you use the unary format, it returns an ordered pair with negated coordinates.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to query and change the ordered pair of integers in an IPair object.
![]() |
public:
Coord coord1() const
Obtains the value of the first coordinate.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
Coord coord2() const
Obtains the value of the second coordinate.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IPair& setCoord1(Coord coord1)
Sets the value of the first coordinate.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IPair& setCoord2(Coord coord2)
Sets the value of the second coordinate.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to alter the coordinate values of an IPair object. This includes both member and nonmember arithmetic operators and members to scale the value of an IPair object.
![]() |
Replaces the coordinates with the remainder when divided by those of the following specified parameters:
public:
IPair& operator %=(long divisor)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IPair& operator %=(const IPair& aPair)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Multiplies the coordinates by those of the specified parameter:
public:
IPair& operator *=(const IPair& aPair)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IPair& operator *=(double multiplier)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IPair& operator +=(const IPair& aPair)
Adds the coordinates of the specified aPair to the coordinates of an ordered pair.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IPair& operator -=(const IPair& aPair)
Subtracts the coordinates specified in aPair from the IPair coordinates.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
Divides the coordinates by those of the second specified parameter:
public:
IPair& operator /=(double divisor)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
public:
IPair& operator /=(const IPair& aPair)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IPair& scaleBy(double xFactor, double yFactor)
Scales the X-coordinate by xFactor; the Y-coordinate by yFactor.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IPair scaledBy(double xFactor, double yFactor) const
Same as IPair::scaleBy, but returns a new IPair, leaving the original unmodified.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
Use these members to determine the smaller or larger of two IPair objects.
![]() |
public:
IPair maximum(const IPair& aPair) const
Returns an ordered pair whose coordinates are the maximum of the corresponding coordinates of the IPair and the specified IPair.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IPair minimum(const IPair& aPair) const
Returns an ordered pair whose coordinates are the minimum of the corresponding coordinates of the IPair and the specified IPair.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
These members are additional, unrelated members of the IPair class.
![]() |
public:
double distanceFrom(const IPair& aPair) const
Returns the distance from some other ordered pair.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
long dotProduct(const IPair& aPair) const
Returns the dot product with another ordered pair.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
IPair& transpose()
Swaps the coordinates of the ordered pair. The friend version of this function returns a new pair with transposed coordinates.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
typedef long Coord
Type of the coordinate values (long integer).
Windows | OS/2 | AIX |
Yes | Yes | Yes |
IPair operator %(const IPair& aPair1, long divisor)
Returns an ordered pair whose coordinates are the remainder of the corresponding coordinates of the IPair (aPair1) and the divisor.
IPair operator %(const IPair& pair1, const IPair& pair2)
Returns an ordered pair whose coordinates are the remainder of the corresponding coordinates of pair1 and pair2.
IPair operator *(const IPair& pair1, const IPair& pair2)
Returns an ordered pair whose coordinates are the product of pair1 and pair2.
The library performs the product function between the corresponding coordinates: coord1 of pair1 with coord1 of pair2 and coord2 with coord2.
IPair operator *(const IPair& pair1, double multiplier)
Returns an ordered pair whose coordinates are the product of pair1 and multiplier.
The library performs the product function between each coordinate of pair1 and the multiplier.
IPair operator +(const IPair& pair1, const IPair& pair2)
Returns an ordered pair whose coordinates are the sums of the corresponding coordinates of pair1 and pair2.
IPair operator -(const IPair& pair1, const IPair& pair2)
Returns an ordered pair whose coordinates are the difference between the corresponding coordinates of pair1 and pair2.
When you use the unary format, it returns an ordered pair with negated coordinates.
IPair operator /(const IPair& pair1, double divisor)
Returns an ordered pair whose coordinates are the quotient of the corresponding coordinates of pair1 and divisor
The library performs the quotient function between each coordinate of pair1 and the divisor.
IPair operator /(const IPair& pair1, const IPair& pair2)
Returns an ordered pair whose coordinates are the quotient of the corresponding coordinates of pair1 and pair2 specified parameter:
The library performs the quotient function between the corresponding coordinates: coord1 of pair1 with coord1 of pair2 and coord2 with coord2.
ostream& operator <<(ostream& aStream, const IPair& aRectangle)
Writes ordered pairs to ostreams in the conventional manner.
IPair transpose(const IPair& aPair)
Swaps the coordinates of the ordered pair. The friend version of this function returns a new pair with transposed coordinates.