point Specification Sheet
Portable Object Compiler (c) 1997,98,99. All Rights Reserved.
Point
Inherits from: Object
Class Description
Point instances are implemented as pairs of two C integers. This is partly because of compatibility with the corresponding ICpak101 class, and partly because it (as opposed to some floating point arithmetic) gives portable results for equality testing.
Method types
Creation
Instance Variables
Comparing
Point Arithmetic
Printing
Methods
+new
Returns the point (0,0).
+x:(int)xy:(int)y
Returns the point (x,y).
-x:(int)xy:(int)y
Resets the coordinates of an existing point to (x,y).
-x:(int)x
Resets the xLoc coordinate. Returns the receiver.
-y:(int)y
Resets the yLoc coordinate. Returns the receiver.
- (int)x
Returns xLoc as int value.
- (int)y
Returns yLoc as int value.
- (unsigned)hash
Returns a hash value based on the values of xLoc and yLoc.
- (BOOL)isEqual:aPoint
Returns YES if both arguments are instances of Point (or of a subclass of Point) and if they have the same coordinates.
- (BOOL)isBelow:aPoint
Returns YES if the receiver's y coordinate is greater than the y coordinate of aPoint.
- (BOOL)isAbove:aPoint
Returns YES if the receiver's y coordinate is less than the y coordinate of aPoint.
- (BOOL)isLeft:aPoint
Returns YES if the receiver's x coordinate is less than the x coordinate of aPoint.
- (BOOL)isRight:aPoint
Returns YES if the receiver's x coordinate is greater than the x coordinate of aPoint.
-moveBy:aPoint
Adds coordinates of aPoint to the receiver. Unlike plus:, this method does not return a new object.
-moveBy:(int)x:(int)y
Adds x and y coordinates of aPoint to the receiver. Unlike plus:, this method does not return a new object.
-moveTo:aPoint
Copies the coordinates of aPoint into the receiver. Typically used for translation.
-plus:aPoint
This method is like moveBy: but it returns a new point instance.
-translateBy:aPoint
This method is like moveBy: but it returns a new point instance.
-printOn:(IOD)aFile
Prints x and y coordinates inside parenthesis.
-fileOutOn:aFiler
Writes the point on aFiler. Returns the receiver.
-fileInFrom:aFiler
Reads the point from aFiler. Returns the receiver.