MethodCategoryChange.st
author vrany
Tue, 31 Jul 2012 14:27:40 +0200
changeset 2873 384700ae948f
parent 2622 853e24f6b303
child 3158 f8c56a311307
child 3984 22c47fc24cd7
permissions -rw-r--r--
Merged from SVN

"
 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' }"

MethodChange subclass:#MethodCategoryChange
	instanceVariableNames:'origin'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Changes'
!

!MethodCategoryChange 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 method-category changes (as done in the browser). 
    They are typically held in a ChangeSet.

    Change origin.

    When a changeset diff is generated, two MethodChanges that 
    represent the same method (code is the same) might differ only in
    category/ Such changes are transformed to MethodCategoruChanges.
    In that case, origin keeps the reference to original MethodChange.

    [author:]
        Claus Gittinger
        Jan Vrany

    [instance variables:]
        origin      <MethodChange>  Change that cause this category
                                    change to be created. See comment.


"
! !

!MethodCategoryChange class methodsFor:'others'!

version_CVS
    ^ '$Header: /cvs/stx/stx/libbasic3/MethodCategoryChange.st,v 1.22 2012-07-31 12:27:40 vrany Exp $'
! !

!MethodCategoryChange methodsFor:'accessing'!

class:cls selector:sel category:cat
    self className:cls name selector:sel category:cat

    "Modified: / 12-11-2006 / 15:55:11 / cg"
!

className:clsName selector:sel category:cat
    className := clsName.
    selector := sel.
    methodCategory := cat

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

origin
    ^ origin
!

origin:aMethodChange
    origin := aMethodChange.
!

prettyPrintedSource
    ^ self sourceForMethod, Character cr 
          , '    category:' , methodCategory storeString

    "Modified: / 09-10-2006 / 13:59:15 / cg"
!

source
    ^ self sourceForMethod , ' category:' , methodCategory storeString

    "Modified: / 09-10-2006 / 13:59:10 / cg"
!

source: aString
    | expr |

    expr := Parser parseExpression: aString onError: [ self error: 'Invalid source'].
    expr isMessage ifFalse:[ self error: 'Invalid source' ].
    expr selector == #'category:' ifFalse:[ self error: 'Invalid source' ].
    methodCategory := expr arguments first value.

    "Created: / 20-03-2012 / 22:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!MethodCategoryChange methodsFor:'applying'!

apply
    "apply the change"

    |mthd|

    mthd := self changeMethod.
    mthd category:methodCategory asSymbol.

    "Modified: / 23-11-2006 / 16:59:09 / cg"
! !

!MethodCategoryChange methodsFor:'testing'!

isMethodCategoryChange
    ^ true
!

isMethodCodeChange
    "true if this is a method's code change (not package, category etc.)"

    ^ false
! !

!MethodCategoryChange methodsFor:'visiting'!

acceptChangeVisitor:aVisitor
    ^ aVisitor visitMethodCategoryChange:self.

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

!MethodCategoryChange class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic3/MethodCategoryChange.st,v 1.22 2012-07-31 12:27:40 vrany Exp $'
!

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