Provides utility functions to condense EditOperations into CompoundEditOperations.
compoundOps = getCondensedBasic([
ReplaceOperation( 0, "private"),
DeleteOperation ( 1 ),
ReplaceOperation( 2, "add2" ),
InsertOperation ( 4, "int" ),
InsertOperation ( 5, "x" ),
DeleteOperation ( 8 ),
DeleteOperation ( 8 ),
DeleteOperation ( 8 ),
InsertOperation ( 8, "return" ),
InsertOperation ( 9, "x" ),
InsertOperation (10, "+" ),
InsertOperation (11, "2" ),
InsertOperation (12, ";" )
])
compoundOps
method = AbstractMethod("public static int foo ( ) { return 0 ; }")
method
method.applyEditOperations(compoundOps)
method
compoundOps = getCondensedLoose([
ReplaceOperation( 0, "private"),
DeleteOperation ( 1 ),
ReplaceOperation( 2, "add2" ),
InsertOperation ( 4, "int" ),
InsertOperation ( 5, "x" ),
DeleteOperation ( 8 ),
DeleteOperation ( 8 ),
DeleteOperation ( 8 ),
InsertOperation ( 8, "return" ),
InsertOperation ( 9, "x" ),
InsertOperation (10, "+" ),
InsertOperation (11, "2" ),
InsertOperation (12, ";" )
])
compoundOps
method = AbstractMethod("public static int foo ( ) { return 0 ; }")
method
method.applyEditOperations(compoundOps)
method
compoundOps = getCondensedStrict([
ReplaceOperation( 0, "private"),
DeleteOperation ( 1 ),
ReplaceOperation( 2, "add2" ),
InsertOperation ( 4, "int" ),
InsertOperation ( 5, "x" ),
DeleteOperation ( 8 ),
DeleteOperation ( 8 ),
DeleteOperation ( 8 ),
InsertOperation ( 8, "return" ),
InsertOperation ( 9, "x" ),
InsertOperation (10, "+" ),
InsertOperation (11, "2" ),
InsertOperation (12, ";" )
])
compoundOps
method = AbstractMethod("public static int foo ( ) { return 0 ; }")
method
method.applyEditOperations(compoundOps)
method
Note: You need not limit yourself to the basic
InsertOperation
, DeleteOperation
and ReplaceOperation
. You can also condense CompoundOperations.compoundOps
getCondensedLoose(compoundOps)