JavaArray.st
author Claus Gittinger <cg@exept.de>
Thu, 24 Nov 2011 12:54:24 +0100
changeset 2290 cd61fd0b66ac
parent 2199 6ef8996019c2
child 2296 d8932033cb01
permissions -rw-r--r--
fixed: #version_SVN ($ to §)

"
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
                            SWING Research Group, Czech Technical University in Prague (*)

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.

 (*) extensions, changes and fixes for java1.1 compatibility.
     For a list of changes, see a list of diffs against the last stable version before 2011-08.
"
"{ Package: 'stx:libjava' }"

Array variableSubclass:#JavaArray
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Java-Classes'
!

JavaArray class instanceVariableNames:'componentClass'

"
 No other class instance variables are inherited by this class.
"
!

!JavaArray class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
                            SWING Research Group, Czech Technical University in Prague (*)

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.

 (*) extensions, changes and fixes for java1.1 compatibility.
     For a list of changes, see a list of diffs against the last stable version before 2011-08.

"
! !

!JavaArray class methodsFor:'initialization'!

setComponentClass:aClass
    componentClass := aClass.

    "Created: / 17-12-2010 / 13:25:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!JavaArray class methodsFor:'accessing'!

javaClass
    ^ self

    "Created: / 19-12-2010 / 17:09:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

javaComponentClass
    ^ componentClass

    "Created: / 20-12-2010 / 22:02:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

javaName
    ^'[L' , componentClass javaName, ';'

    "Created: / 25-02-2011 / 19:29:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

javaPackage

    ^componentClass javaPackage

    "Created: / 22-05-2011 / 18:07:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

lookupMethodByNameAndType: aJavaNameAndType 

    "Trick, since java arrays should respond to all messages
     understood by java.lang.object"    
    ^ (Java at:'java.lang.Object') lookupMethodByNameAndType: aJavaNameAndType

    "Created: / 22-05-2011 / 18:03:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!JavaArray class methodsFor:'class creation'!

javaArrayClass

    ^self javaArrayClassFor: self.

    "Created: / 11-06-2011 / 23:35:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

javaArrayClassFor: aJavaClass

    | meta cls |

    meta := Metaclass new.
    meta setSuperclass: JavaArray class.
    meta instSize: JavaArray class instSize.
    cls := meta new.
    cls setSuperclass: JavaArray.
    cls flags: JavaArray flags.
    cls instSize: JavaArray instSize.
    cls setComponentClass: aJavaClass.
    cls setName: (aJavaClass name , '[]') asSymbol.
    "Kludge, spec says"
    "All methods of class Object may be invoked on an array."
    cls setMethodDictionary: (Java classForName: 'java.lang.Object') methodDictionary.

    ^cls

    "
        JavaArray javaArrayClassFor: Object
    "

    "Created: / 17-12-2010 / 13:45:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 01-03-2011 / 14:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!JavaArray class methodsFor:'queries'!

hasInterface:aJavaInterface
    "return true, if I respond to all methods as
     aJavaInterface"

    ^false

    "Modified: / 19-12-2010 / 16:45:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isAbstract
    "return true, if the receiver is abstract
     (i.e. may not have instances)"

    ^ false

    "Modified: / 19-12-2010 / 16:45:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isFinal
    "return true, if the receiver is final
     (i.e. may not be subclassed)"

    ^ false

    "Modified: / 19-12-2010 / 16:45:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isInitialized
    "return true, if the receiver is initialized"

    ^ true

    "Modified: / 07-05-1998 / 12:23:54 / cg"
    "Modified: / 19-12-2010 / 16:45:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isInterface
    "return true, if the receiver is an interface"

    ^ false

    "Modified: / 07-05-1998 / 12:23:39 / cg"
    "Modified: / 19-12-2010 / 16:45:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isJavaArrayClass

    ^true

    "Created: / 19-12-2010 / 17:05:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isJavaReferenceType

    ^true

    "Created: / 20-12-2010 / 21:58:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isJavaType

    ^true

    "Created: / 20-12-2010 / 21:58:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isObsolete
    "return true, if the receiver is obsolete
     Java classes are never."

    ^ false

    "Modified: / 07-08-1997 / 19:04:28 / cg"
    "Modified: / 19-12-2010 / 16:45:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isPublic
    "return true, if the receiver is public"

    ^ true

    "Modified: / 19-12-2010 / 16:45:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

isUnresolved

    ^false

    "Created: / 21-12-2010 / 12:51:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!JavaArray class methodsFor:'documentation'!

version_CVS
    ^ '$Header: /cvs/stx/stx/libjava/JavaArray.st,v 1.2 2011-11-24 11:13:51 cg Exp $'
!

version_SVN
    ^ '§Id: JavaArray.st,v 1.1 2011/08/18 19:06:53 vrany Exp §'
! !