// position: 0 1 2 3
// index: -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13
// | | A | | B | | C | |
- // interval |<--------->|<--->|<--------------->|<------
+ // interval |<--------->|<--->|<--------------->|<----|
//
// [-1 99 (9 89)]
// [0 10 (-1 9)] [-10 0 (89 99)]
// If this is the left node, the values are relative to the
// parent's total_start. Otherwise, the values are relative to
// the parent's total_end. So:
- // total_start total_end
- // left-side interval 0 positive
- // right-side interval negative 0
- // top-most interval -1 positive
+ // total_start total_end
+ // left-side interval 0 positive even
+ // right-side interval negative even 0
+ // top-most interval -1 positive odd
private int total_start, total_end;
// Stack of MTextProperty
private Stack<MTextProperty> stack;
private MInterval Left {
get {
- MInterval interval;
-
+ MInterval i;
if (left != null)
- for (interval = left;
- interval.right != null;
- interval = interval.right);
+ for (i = left; i.right != null; i = i.right);
else
- for (interval = parent;
- interval != null && interval.total_start == 0;
- interval = interval.parent);
-
- return interval;
+ for (i = parent; i != null && i.total_start == 0; i = i.parent);
+ return i;
}
}
private MInterval Right {
get {
- MInterval interval;
-
+ MInterval i;
if (right != null)
- for (interval = right;
- interval.left != null;
- interval = interval.left);
+ for (i = right; i.left != null; i = i.left);
else
- for (interval = parent;
- interval != null && interval.total_start < 0;
- interval = interval.parent);
-
- return interval;
+ for (i = parent; i != null && i.total_start < 0; i = i.parent);
+ return i;
}
}
{
// position: 0 1 2 3
// index: -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13
- // this |<----------<-------------->->|
- // |<--------->| |<>|
+ // this |<----------<----------->---->|
+ // |<--------->| |<--->|
//
- // interval |<->----->->|
+ // BBBBB
+ // AAAAA
+ // interval |<--->|
//
// new |<----------<----->----->-->------------>->|
// |<--------->| |<---->-->------------>->|