}
}
- public class MText : IEnumerable, IComparable<MText>, IEquatable<MText>
+ public class MText : IEnumerable, IEquatable<MText>, IComparable<MText>
{
#if false
public enum MTextFormat format;
return mt;
}
+ // Public properties
public bool ReadOnly { get { return read_only; } }
public int Length { get { return nchars; } }
+ // Public methods
+
+ // for IEnumerable interface
+ public IEnumerator GetEnumerator() { return new MTextEnum (this); }
+
+ // for IEquatable interface
+ public bool Equals (MText other) { return this.sb.Equals (other.sb); }
+
+ // for IComparable interface
public int CompareTo (MText other)
{
return this.sb.ToString ().CompareTo (other.sb.ToString ());
}
- public bool Equals (MText other)
- {
- return this.sb.Equals (other.sb);
- }
-
- public override String ToString ()
- {
- return sb.ToString ();
- }
+ public override String ToString () { return sb.ToString (); }
private static bool surrogate_high_p (char c)
{
int to_idx = pos_to_idx (mt2, to);
sb.Insert (pos_idx, mt2.sb.ToString (from_idx, to_idx - from_idx));
+#if false
+ if (root_interval != null)
+ {
+ MInterval interval;
+
+ if (mt2.root_interval != null)
+ interval = mt2.root_interval.Copy (from, to);
+ root_interval.Insert (pos, interval);
+ }
+#endif
nchars += to - from;
}
root_interval.Push (from, to, prop);
}
- public IEnumerator GetEnumerator()
- {
- return new MTextEnum (this);
- }
-
private class MInterval
{
// Start and end positions of this interval and its children.
private int depth;
private MInterval left, right, parent;
+ private static int adjust_position (int pos, bool front_inclusive)
+ {
+ return (pos << 2) + (front_inclusive ? -1 : 1);
+ }
+
public MInterval (int start, bool front_inclusive,
int end, bool rear_inclusive)
{
this.depth = 1;
}
+ public MInterval Copy (int start, int end, MInterval interval)
+ {
+ MInterval new_interval;
+
+ start = adjust_position (start, true);
+ end = adjust_position (end, true);
+ new_interval = new MInterval (start, end, interval.stack);
+ return new_interval;
+ }
+
private MInterval Copy ()
{
return new MInterval (total_start, total_end, stack);
push (start, end, prop);
}
+ public void Insert (int start, int end, MInterval interval)
+ {
+ }
+
private MInterval divide_right (int pos)
{
MInterval interval = Copy ();