Diff3.st
branchjv
changeset 12218 8b88c30fb1e7
parent 12202 eaa1f6cb6ce8
child 12225 60dfd3fa018d
equal deleted inserted replaced
12217:2c68d7169f97 12218:8b88c30fb1e7
   159 	^ file2
   159 	^ file2
   160 !
   160 !
   161 
   161 
   162 file2: anObject
   162 file2: anObject
   163 	file2 := anObject
   163 	file2 := anObject
       
   164 !
       
   165 
       
   166 fileAt: side
       
   167     "Given a side (#left, #original or #right), returns the
       
   168     corresponding file"
       
   169 
       
   170     side == #left       ifTrue:[ ^ file0 ].
       
   171     side == #original   ifTrue:[ ^ file1 ].
       
   172     side == #right      ifTrue:[ ^ file2 ].
       
   173 
       
   174     self error:'Invalid parameter, must be one of #left, #original or #right'.
       
   175 
       
   176     "Created: / 03-04-2012 / 23:30:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   164 ! !
   177 ! !
   165 
   178 
   166 !Diff3 methodsFor:'merging'!
   179 !Diff3 methodsFor:'merging'!
   167 
   180 
   168 diffIndices
   181 diffIndices
   491 extractFrom: aCollection
   504 extractFrom: aCollection
   492 	"Extracts a subcollection from aCollection corresponding to my offset and length."
   505 	"Extracts a subcollection from aCollection corresponding to my offset and length."
   493 	^ aCollection copyFrom: offset to: offset + length - 1.
   506 	^ aCollection copyFrom: offset to: offset + length - 1.
   494 !
   507 !
   495 
   508 
       
   509 extractFrom: aCollection offset: lineOffset
       
   510     "Given a text and lineOffset withing a chunk, return the line"
       
   511     ^ aCollection at: offset + lineOffset - 1
       
   512 
       
   513     "Created: / 04-04-2012 / 00:46:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   514 !
       
   515 
       
   516 extractFromDiff: diff
       
   517 
       
   518     ^self extractFrom: (diff fileAt: side)
       
   519 
       
   520     "Created: / 03-04-2012 / 23:33:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   521 !
       
   522 
       
   523 extractResolution
       
   524 
       
   525     side == #left     ifTrue:[ ^ #MergedUsingA ].
       
   526     side == #original ifTrue:[ ^ #MergedUsingBase ].
       
   527     side == #right    ifTrue:[ ^ #MergedUsingB ].
       
   528 
       
   529     self error:'Should not be reached'
       
   530 
       
   531     "Created: / 04-04-2012 / 00:26:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   532 !
       
   533 
   496 printOn: aStream
   534 printOn: aStream
   497         aStream nextPut: $(.
   535         aStream nextPut: $(.
   498         super printOn: aStream.
   536         super printOn: aStream.
   499         aStream
   537         aStream
   500                 nextPutAll: ' side: ';
   538                 nextPutAll: ' side: ';
   720 ! !
   758 ! !
   721 
   759 
   722 !Diff3 class methodsFor:'documentation'!
   760 !Diff3 class methodsFor:'documentation'!
   723 
   761 
   724 version_SVN
   762 version_SVN
   725     ^ '$Id: Diff3.st 7948 2012-03-21 01:52:35Z vranyj1 $'
   763     ^ '$Id: Diff3.st 7965 2012-04-04 00:09:32Z vranyj1 $'
   726 ! !
   764 ! !