--- a/Point.st Mon Mar 19 14:48:53 2018 +0100
+++ b/Point.st Tue Mar 20 11:46:00 2018 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -328,15 +330,15 @@
!Point methodsFor:'comparing'!
-< aPoint
+< aPointOrNumber
"return true if the receiver is above and to the left
- of the argument, aPoint"
+ of the argument, aPointOrNumber"
|p|
- p := aPoint asPoint.
+ p := aPointOrNumber asPoint.
x < (p x) ifTrue:[
- y < (p y) ifTrue:[^ true].
+ y < (p y) ifTrue:[^ true].
].
^ false
@@ -349,34 +351,37 @@
(4@4) > (3@4)
"
- "Modified: 7.5.1996 / 12:14:25 / cg"
+ "Modified: / 07-05-1996 / 12:14:25 / cg"
+ "Modified (comment): / 20-03-2018 / 10:23:33 / stefan"
!
-= aPoint
+= aPointOrNumber
"return true if the receiver represents the same point as
the argument, aPoint"
|p|
- (aPoint isMemberOf:Point) ifTrue:[ "this is a hint to STC"
- x ~= (aPoint x) ifTrue:[^ false].
- y ~= (aPoint y) ifTrue:[^ false].
- ^ true
+ (aPointOrNumber isMemberOf:Point) ifTrue:[ "this is a hint to STC"
+ x ~= (aPointOrNumber x) ifTrue:[^ false].
+ y ~= (aPointOrNumber y) ifTrue:[^ false].
+ ^ true
].
- aPoint respondsToArithmetic ifFalse:[ ^ false].
- p := aPoint asPoint.
- x ~= (p x) ifTrue:[^ false].
- y ~= (p y) ifTrue:[^ false].
- ^ true
+ aPointOrNumber respondsToArithmetic ifFalse:[
+ ^ false
+ ].
+ p := aPointOrNumber asPoint.
+ ^ x = p x and:[y = p y].
+
+ "Modified: / 20-03-2018 / 10:27:57 / stefan"
!
-> aPoint
+> aPointOrNumber
"return true if the receiver is below and to the right
of the argument, aPoint"
|p|
- p := aPoint asPoint.
+ p := aPointOrNumber asPoint.
(p x) < x ifTrue:[
(p y) < y ifTrue:[^ true].
].
@@ -384,6 +389,7 @@
"Modified: / 07-05-1996 / 12:11:15 / cg"
"Modified (comment): / 27-09-2017 / 15:55:14 / mawalch"
+ "Modified (format): / 20-03-2018 / 10:10:13 / stefan"
!
hash
@@ -1092,14 +1098,14 @@
"speedup for common cases ..."
(translation isMemberOf:Point) ifTrue:[
- ^ self class x:(x - translation x) y:(y - translation y)
+ ^ self class x:(x - translation x) y:(y - translation y)
].
(translation isMemberOf:SmallInteger) ifTrue:[
- "/ same as below, but stc can do better here
- ^ self class x:(x - translation) y:(y - translation)
+ "/ same as below, but stc can do better here
+ ^ self class x:(x - translation) y:(y - translation)
].
translation isNumber ifTrue:[
- ^ self class x:(x - translation) y:(y - translation)
+ ^ self class x:(x - translation) y:(y - translation)
].
"this is the general (& clean) code ..."
@@ -1107,7 +1113,8 @@
translationPoint := translation asPoint.
^ self class x:(x - translationPoint x) y:(y - translationPoint y).
- "Modified: 25.1.1997 / 17:27:46 / cg"
+ "Modified: / 25-01-1997 / 17:27:46 / cg"
+ "Modified: / 20-03-2018 / 10:22:43 / stefan"
!
/ scale