ClassCommentChange.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 12 Jun 2013 11:54:30 +0100
branchjv
changeset 3303 7ed5d48e3756
parent 3219 92e64a42ab4e
child 3838 474d8ec95b33
permissions -rw-r--r--
Refactoring of class names and namespaces in ClassChange (part 1). The meaning of instvars in ClassChange was changed (well, actually it was defined), so: - className is the name of the class without any namespace prefix but including all owning classes. - nameSpaceName is the name of the original namespace of the class - nameSpaceOverride is client-enforced namespace namew - ownerClassName is the name of the owning class but without any namespace prefix. This commit actually fixes remaining RegressionTests::ChangeSetTests. CAUTION: currently, class names and namespace names are wrong when reading system changefile. This is due to a conceptual problem because there's no way how distinguish between namespace and owning class solely on the information in the changeset file. Next part of the refactoring should fix this, but at the cost of changing the changefile format. The impact to old tools not using ChangeSet but rather their own implementation must be investigated (tools like ChangesBrowser).

"
 COPYRIGHT (c) 1993 by Claus Gittinger
	      All Rights Reserved

 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.
"
"{ Package: 'stx:libbasic3' }"

ClassChange subclass:#ClassCommentChange
	instanceVariableNames:'comment'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Changes'
!

!ClassCommentChange class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1993 by Claus Gittinger
	      All Rights Reserved

 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.
"
!

documentation
"
    instances represent class comment-changes. 
    They are typically held in a ChangeSet.

    [author:]
        Claus Gittinger
"
! !

!ClassCommentChange class methodsFor:'others'!

version_CVS
    ^ '$Header: /cvs/stx/stx/libbasic3/ClassCommentChange.st,v 1.35 2013-04-14 06:57:10 cg Exp $'
! !

!ClassCommentChange methodsFor:'accessing'!

className:clsName comment:aCommentString
    className := clsName.
    comment := aCommentString

    "Created: / 16.2.1998 / 14:16:45 / cg"
!

comment
    ^ comment
!

comment:aCommentString
    comment := aCommentString

    "Created: / 16.2.1998 / 14:16:45 / cg"
! !

!ClassCommentChange methodsFor:'comparing'!

isConflict
    "true if this change is different than what is already in the image
     (i.e. it overwrites some existing code)"

    |cls|

    ^ (cls := self changeClass) notNil
    and:[ cls comment ~= self comment ]
!

isForSameAs:changeB
    "return true, if the given change represents a change for the same
     thingy as the receiver (i.e. same method, same definition etc.)."

    changeB isClassCommentChange ifFalse:[^ false].   
    ^ className = changeB className


!

sameAs:changeB
    "return true, if the given change represents the same change as the receiver."

    (self isForSameAs:changeB) ifFalse:[^ false].
    ^ comment = changeB comment

    "Modified: / 06-10-2006 / 14:06:02 / cg"
!

source
    "synthesize the changes source"

    ^ String streamContents: [:s |
            self printOn:s.
            comment storeOn:s.
        ]
! !

!ClassCommentChange methodsFor:'converting'!

asAntiChange

    ^self copy comment:''

    "Created: / 26-11-2009 / 16:09:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!ClassCommentChange methodsFor:'printing & storing'!

printOn:aStream
    "append a user printed representation of the receiver to aStream.
     The format is suitable for a human - not meant to be read back."

"/    |ns|
"/
"/    ns := self nameSpaceName.
"/    ns notNil ifTrue:[
"/        aStream nextPutAll:ns; nextPutAll:'::'
"/    ].
    aStream 
        nextPutAll:self className; 
        nextPutAll:' comment:'
!

printWithoutClassNameOn:aStream
    (className endsWith:' class') ifTrue:[
        aStream nextPutAll:'class '
    ].
    aStream nextPutAll:'comment:'
! !

!ClassCommentChange methodsFor:'queries'!

isClassCommentChange
    ^ true


! !

!ClassCommentChange methodsFor:'visiting'!

acceptChangeVisitor:aVisitor
    ^ aVisitor visitClassCommentChange:self.

    "Created: / 25-11-2011 / 17:13:02 / cg"
! !

!ClassCommentChange class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic3/ClassCommentChange.st,v 1.35 2013-04-14 06:57:10 cg Exp $'
!

version_HG

    ^ '$Changeset: <not expanded> $'
!

version_SVN
    ^ '§Id: ClassCommentChange.st 1909 2012-03-31 00:14:49Z vranyj1 §'
! !