From: handa Date: Fri, 16 Jan 2009 09:23:41 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=8390a457e2cc9f50e97c551dfd6d6244ac6970c5;p=m17n%2Fm17n-lib-cs.git *** empty log message *** --- diff --git a/MText.cs b/MText.cs index 836c4f4..1fbb3f0 100644 --- a/MText.cs +++ b/MText.cs @@ -313,14 +313,27 @@ namespace M17N.Core this.depth = 1; } - public MInterval Copy (int start, int end, MInterval interval) + private MInterval find (int pos) { - MInterval new_interval; + if (pos < total_start || total_end < pos) + return null; + if (pos < Start) + return left.find (pos); + if (End < pos) + return right.find (pos); + return this; + } + + public MInterval Copy (int start, int end) + { + MInterval interval_start = find (start); + MInterval interval_end = find (end); + MInterval interval; start = adjust_position (start, true); end = adjust_position (end, true); - new_interval = new MInterval (start, end, interval.stack); - return new_interval; + interval = new MInterval (start, end, stack); + return interval; } private MInterval Copy ()