comparison dwtx/text/edits/MoveSourceEdit.d @ 130:b56e9be9fe88

ctors to this
author Frank Benoit <benoit@tionex.de>
date Sun, 24 Aug 2008 00:30:47 +0200
parents eb30df5ca28b
children c4fb132a086c
comparison
equal deleted inserted replaced
129:eb30df5ca28b 130:b56e9be9fe88
57 * Constructs a new move source edit. 57 * Constructs a new move source edit.
58 * 58 *
59 * @param offset the edit's offset 59 * @param offset the edit's offset
60 * @param length the edit's length 60 * @param length the edit's length
61 */ 61 */
62 public MoveSourceEdit(int offset, int length) { 62 public this(int offset, int length) {
63 super(offset, length); 63 super(offset, length);
64 } 64 }
65 65
66 /** 66 /**
67 * Constructs a new copy source edit. 67 * Constructs a new copy source edit.
68 * 68 *
69 * @param offset the edit's offset 69 * @param offset the edit's offset
70 * @param length the edit's length 70 * @param length the edit's length
71 * @param target the edit's target 71 * @param target the edit's target
72 */ 72 */
73 public MoveSourceEdit(int offset, int length, MoveTargetEdit target) { 73 public this(int offset, int length, MoveTargetEdit target) {
74 this(offset, length); 74 this(offset, length);
75 setTargetEdit(target); 75 setTargetEdit(target);
76 } 76 }
77 77
78 /* 78 /*
79 * Copy constructor 79 * Copy constructor
80 */ 80 */
81 private MoveSourceEdit(MoveSourceEdit other) { 81 private this(MoveSourceEdit other) {
82 super(other); 82 super(other);
83 if (other.fModifier !is null) 83 if (other.fModifier !is null)
84 fModifier= other.fModifier.copy(); 84 fModifier= other.fModifier.copy();
85 } 85 }
86 86
88 * Returns the associated target edit or <code>null</code> 88 * Returns the associated target edit or <code>null</code>
89 * if no target edit is associated yet. 89 * if no target edit is associated yet.
90 * 90 *
91 * @return the target edit or <code>null</code> 91 * @return the target edit or <code>null</code>
92 */ 92 */
93 public MoveTargetEdit getTargetEdit() { 93 public this getTargetEdit() {
94 return fTarget; 94 return fTarget;
95 } 95 }
96 96
97 /** 97 /**
98 * Sets the target edit. 98 * Sets the target edit.
376 return null; 376 return null;
377 int length2= op2.getLength(); 377 int length2= op2.getLength();
378 int end2= offset2 + length2 - 1; 378 int end2= offset2 + length2 - 1;
379 if (end2 < offset1) 379 if (end2 < offset1)
380 return null; 380 return null;
381 381
382 int end= Math.min(end1, end2); 382 int end= Math.min(end1, end2);
383 if (offset1 < offset2) { 383 if (offset1 < offset2) {
384 return new Region(offset2, end - offset2 + 1); 384 return new Region(offset2, end - offset2 + 1);
385 } 385 }
386 return new Region(offset1, end - offset1 + 1); 386 return new Region(offset1, end - offset1 + 1);