extensions.st
branchdevelopment
changeset 2965 bac7022ca26a
parent 2942 c39cbf09ea3d
parent 2604 b9cb81e47766
child 2974 36b5b06398b5
--- a/extensions.st	Wed Dec 18 00:02:10 2013 +0100
+++ b/extensions.st	Wed Dec 18 12:03:32 2013 +0100
@@ -115,6 +115,30 @@
     "Modified: / 07-05-2013 / 11:21:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!BooleanArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BooleanArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == BooleanArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!BooleanArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^BooleanArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !BooleanArray methodsFor:'queries'!
 
 isInterface
@@ -176,6 +200,30 @@
     "Modified: / 31-08-2011 / 23:57:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!ByteArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ByteArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == BooleanArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ByteArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^BooleanArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ByteArray class methodsFor:'testing'!
 
 isInterface
@@ -295,6 +343,37 @@
     "Modified: / 07-05-2013 / 11:21:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!CharacterArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CharacterArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    cls == Unicode16String ifTrue:[^self].
+    cls == String          ifTrue:[^self].
+    ^JavaVM throwClassCastException.
+
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:10:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!CharacterArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    cls == Unicode16String ifTrue:[^1].
+    cls == String          ifTrue:[^1].
+    ^0
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:10:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !CharacterArray methodsFor:'java conversions'!
 
 asDottedJavaClassName
@@ -664,6 +743,32 @@
     "Modified: / 25-07-2013 / 11:34:54 / cg"
 ! !
 
+!DoubleArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!DoubleArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == DoubleArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!DoubleArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^DoubleArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !DoubleArray class methodsFor:'testing'!
 
 isInterface
@@ -798,6 +903,32 @@
     "Modified: / 07-05-2013 / 11:21:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!FloatArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!FloatArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == FloatArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!FloatArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^FloatArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !FloatArray class methodsFor:'testing'!
 
 isInterface
@@ -1027,6 +1158,30 @@
     "Created: / 22-08-2012 / 13:20:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!Object methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^JavaVM _ARRAYLENGTH: self
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Object methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^JavaVM _CHECKCAST: self _: cls
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!Object methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^JavaVM _INSTANCEOF: self _: cls
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !Object methodsFor:'accessing-Java'!
 
 getJavaLockWord
@@ -1524,6 +1679,32 @@
     "Created: / 24-02-2012 / 19:42:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!SignedIntegerArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedIntegerArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == SignedIntegerArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedIntegerArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^SignedIntegerArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:11:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !SignedIntegerArray class methodsFor:'testing'!
 
 isInterface
@@ -1568,6 +1749,32 @@
     "Modified: / 25-02-2011 / 19:03:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!SignedLongIntegerArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedLongIntegerArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == SignedLongIntegerArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:14:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedLongIntegerArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^SignedLongIntegerArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:14:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !SignedLongIntegerArray class methodsFor:'testing'!
 
 isInterface
@@ -1622,6 +1829,32 @@
     "Modified: / 25-02-2011 / 19:03:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!SignedWordArray methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^self basicSize
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedWordArray methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^cls == SignedWordArray ifTrue:[self] ifFalse:[JavaVM throwClassCastException]
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:14:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SignedWordArray methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^SignedWordArray == cls ifTrue:[1] ifFalse:[0]
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:14:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !SignedWordArray class methodsFor:'queries'!
 
 isJavaArrayClass
@@ -1729,6 +1962,32 @@
     "Created: / 18-01-2013 / 22:27:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!UndefinedObject methodsFor:'vm support'!
+
+_ARRAYLENGTH: cls
+    ^JavaVM throwNullPointerException
+
+    "Created: / 14-05-2013 / 10:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!UndefinedObject methodsFor:'vm support'!
+
+_CHECKCAST: cls
+    ^nil
+
+    "Created: / 14-05-2013 / 10:09:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!UndefinedObject methodsFor:'vm support'!
+
+_INSTANCEOF: cls
+    ^0
+
+    "Created: / 14-05-2013 / 10:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-05-2013 / 11:10:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !UndefinedObject class methodsFor:'queries'!
 
 isJavaPrimitiveType
@@ -1893,6 +2152,17 @@
     "Created: / 04-12-2011 / 11:24:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!ZipArchive methodsFor:'queries - java support'!
+
+isValidFile: path
+    "Return true, if the recevier contains given file. false otherwise.
+    "
+    ^zipMembersByName includesKey: path
+
+    "Created: / 20-05-2013 / 23:37:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+
+! !
+
 !ZipArchive methodsFor:'reading - java support'!
 
 nextBytes: bytesToRead of: zmember startingAt: pos into: b startingAt: off