#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Sat, 31 Dec 2016 01:05:21 +0100
changeset 4246 c4093b605f67
parent 4245 79cce4a51ea1
child 4247 11f26c6f2d17
child 4254 7cccdc94fa82
#REFACTORING by stefan class: RunArray changed: #=
RunArray.st
--- a/RunArray.st	Thu Dec 29 22:53:02 2016 +0100
+++ b/RunArray.st	Sat Dec 31 01:05:21 2016 +0100
@@ -660,21 +660,18 @@
 
     |otherContents idx1 idx2 runCount1 runValue1 runCount2 runValue2|
 
-    aCollection class == self class ifFalse:[
+    aCollection class ~~ self class ifTrue:[
+        idx1 := 1.
         aCollection isSequenceable ifTrue:[
-            idx1 := 1.
             self do:[:element |
                 idx1 > aCollection size ifTrue:[^ false].
                 element = (aCollection at:idx1) ifFalse:[^ false].
                 idx1 := idx1+1.
             ].
-            idx1 > aCollection size ifFalse:[^ false].
-            ^ true.
+            ^ idx1 > aCollection size.
         ].
 
-        idx1 := 1.
         runCount1 := 0.
-
         aCollection do:[:element |
             runCount1 == 0 ifTrue:[
                 idx1 >= contentsArray size ifTrue:[^ false].
@@ -687,24 +684,20 @@
             runCount1 := runCount1 - 1.
         ].
         runCount1 ~~ 0 ifTrue:[^ false].
-        idx1 >= contentsArray size ifFalse:[^ false].
-        ^ true
+        ^ idx1 >= contentsArray size.
     ].
+
     otherContents := aCollection getContentsArray.
     otherContents = contentsArray ifTrue:[^ true].
 
-    idx1 := 1.
-    runCount1 := 0.
-
-    idx2 := 1.
-    runCount2 := 0.
+    idx1 := idx2 := 1.
+    runCount1 := runCount2 := 0.
 
     [
         runCount1 == 0 ifTrue:[
             idx1 >= contentsArray size ifTrue:[
                 idx2+1 <= otherContents size ifTrue:[^ false].
-                runCount2 ~~ 0 ifTrue:[^ false].
-                ^ true.
+                ^ runCount2 == 0.
             ].
             runCount1 := contentsArray at:idx1.
             runValue1 := contentsArray at:idx1+1.