LineSegment.st
changeset 287 779c959ab8f4
parent 286 09da374b5438
child 317 7213ea91be61
--- a/LineSegment.st	Wed May 08 21:35:46 1996 +0200
+++ b/LineSegment.st	Wed May 08 22:16:09 1996 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+
+
 Geometric subclass:#LineSegment
 	instanceVariableNames:'startPoint endPoint'
 	classVariableNames:''
@@ -115,6 +117,29 @@
     "Created: 8.5.1996 / 20:48:32 / cg"
 ! !
 
+!LineSegment methodsFor:'comparing'!
+
+= aLineSegment
+    "return true, if the receiver represents the same lineSegment
+     as the argument, aLineSegment"
+
+    aLineSegment species ~~ self species ifTrue:[^ false].
+    ^ (startPoint = aLineSegment start
+      and:[endPoint = aLineSegment end])
+
+    "Created: 8.5.1996 / 22:13:02 / cg"
+    "Modified: 8.5.1996 / 22:14:34 / cg"
+!
+
+hash
+    "return a number useul for hashing.
+     Redefined, since #= is redefined."
+
+    ^ (startPoint hash bitShift:12) bitOr:(endPoint hash)
+
+    "Modified: 8.5.1996 / 22:14:12 / cg"
+! !
+
 !LineSegment methodsFor:'converting'!
 
 asPointArray
@@ -176,5 +201,5 @@
 !LineSegment class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/LineSegment.st,v 1.3 1996-05-08 19:35:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/LineSegment.st,v 1.4 1996-05-08 20:16:09 cg Exp $'
 ! !