#QUALITY by cg
authorClaus Gittinger <cg@exept.de>
Sun, 09 Jun 2019 14:57:12 +0200
changeset 24312 7bb5c478d08b
parent 24311 196e4a37ae7a
child 24313 cbf78827333d
#QUALITY by cg class: SignedByteArray comment/format in: #asSignedByteArray changed: #beUnsigned
SignedByteArray.st
--- a/SignedByteArray.st	Sun Jun 09 14:55:26 2019 +0200
+++ b/SignedByteArray.st	Sun Jun 09 14:57:12 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2016 by eXept Software AG
               All Rights Reserved
@@ -151,7 +153,12 @@
 !SignedByteArray methodsFor:'converting'!
 
 asSignedByteArray
+    "return the receiver as a signed byteArray.
+     That is the receiver already"
+
     ^ self.
+
+    "Modified (comment): / 09-06-2019 / 14:50:13 / Claus Gittinger"
 !
 
 asUnsignedByteArray
@@ -176,9 +183,13 @@
 !
 
 beUnsigned
-    "make myself unsigned.
-     elements < 0 are converted to positive numbers."
+    "destructively make myself unsigned.
+     elements < 0 are converted to positive numbers.
+     WARNING: this changes the receiver itself - use this only for initialization of new instances"
 
+    self isImmutable ifTrue:[
+        self noModificationError.
+    ].    
     self class == SignedByteArray ifTrue:[
         self changeClassTo:ByteArray.
     ] ifFalse:[
@@ -188,6 +199,8 @@
     "
         #(-1 -128 3 4) asSignedByteArray beUnsigned
     "
+
+    "Modified: / 09-06-2019 / 14:56:41 / Claus Gittinger"
 ! !
 
 !SignedByteArray methodsFor:'filling & replacing'!