@@ -559,6 +559,17 @@ public int getArgIndex() {
559
559
return argIndex ;
560
560
}
561
561
562
+ public abstract VirtualEdgeTarget clone ();
563
+
564
+ /**
565
+ * Clones the edge, but with a potentially different arg index
566
+ *
567
+ * @param argIndex
568
+ * the arg index to set in the clone
569
+ * @return the clone
570
+ */
571
+ public abstract VirtualEdgeTarget clone (int argIndex );
572
+
562
573
public MethodSubSignature getTargetMethod () {
563
574
return targetMethod ;
564
575
}
@@ -629,6 +640,14 @@ public DirectTarget(RefType targetType, MethodSubSignature targetMethod) {
629
640
super (targetType , targetMethod );
630
641
}
631
642
643
+ public DirectTarget clone () {
644
+ return new DirectTarget (targetType , targetMethod , argIndex );
645
+ }
646
+
647
+ public DirectTarget clone (int argIndex ) {
648
+ return new DirectTarget (targetType , targetMethod , argIndex );
649
+ }
650
+
632
651
@ Override
633
652
public String toString () {
634
653
return String .format ("Direct to %s%s on %s" , targetType != null ? targetType .getClassName () + ": " : "" ,
@@ -699,6 +718,22 @@ public IndirectTarget(RefType targetType, MethodSubSignature targetMethod) {
699
718
super (targetType , targetMethod );
700
719
}
701
720
721
+ public IndirectTarget clone () {
722
+ IndirectTarget d = new IndirectTarget (targetType , targetMethod , argIndex );
723
+ for (VirtualEdgeTarget i : getTargets ()) {
724
+ d .addTarget (i .clone ());
725
+ }
726
+ return d ;
727
+ }
728
+
729
+ public IndirectTarget clone (int argIndex ) {
730
+ IndirectTarget d = new IndirectTarget (targetType , targetMethod , argIndex );
731
+ for (VirtualEdgeTarget i : getTargets ()) {
732
+ d .addTarget (i .clone ());
733
+ }
734
+ return d ;
735
+ }
736
+
702
737
public void addTarget (VirtualEdgeTarget target ) {
703
738
if (!targets .contains (target )) {
704
739
targets .add (target );
0 commit comments