private static void MoveNodesAfter(Shape shape, ShapeNode cur, Span <ShapeNode> span) { foreach (ShapeNode node in shape.GetNodes(span).ToArray()) { if (node.Type() == HCFeatureSystem.Segment) { node.Remove(); cur.AddAfter(node); node.SetDirty(true); } cur = node; } }
private void CombineWith(ShapeNode node, ShapeNode start, ShapeNode end) { if ((CombineVowels && node.Type() == CogFeatureSystem.VowelType) || (CombineConsonants && node.Type() == CogFeatureSystem.ConsonantType)) { var strRep = new StringBuilder(); var origStrRep = new StringBuilder(); strRep.Append(node.StrRep()); origStrRep.Append(node.OriginalStrRep()); ShapeNode n = start; while (n != end.Next) { strRep.Append(n.StrRep()); origStrRep.Append(n.OriginalStrRep()); node.Annotation.FeatureStruct.Add(n.Annotation.FeatureStruct); n = n.Next; } node.Annotation.FeatureStruct.AddValue(CogFeatureSystem.StrRep, strRep.ToString()); node.Annotation.FeatureStruct.AddValue(CogFeatureSystem.OriginalStrRep, origStrRep.ToString()); node.Annotation.FeatureStruct.AddValue(CogFeatureSystem.SegmentType, CogFeatureSystem.Complex); FeatureStruct firstFS; if (start.IsComplex()) { firstFS = start.Annotation.FeatureStruct.GetValue(CogFeatureSystem.First); } else { firstFS = new FeatureStruct(); foreach (Feature feature in start.Annotation.FeatureStruct.Features.Where(f => !CogFeatureSystem.Instance.ContainsFeature(f))) { firstFS.AddValue(feature, start.Annotation.FeatureStruct.GetValue(feature)); } } node.Annotation.FeatureStruct.AddValue(CogFeatureSystem.First, firstFS); } else { ShapeNode n = start; while (n != end.Next) { var newNode = n.Clone(); node.AddAfter(newNode); node = newNode; n = n.Next; } } }
private void CombineWith(ShapeNode node, ShapeNode start, ShapeNode end) { if ((CombineVowels && node.Type() == CogFeatureSystem.VowelType) || (CombineConsonants && node.Type() == CogFeatureSystem.ConsonantType)) { var strRep = new StringBuilder(); var origStrRep = new StringBuilder(); strRep.Append(node.StrRep()); origStrRep.Append(node.OriginalStrRep()); ShapeNode n = start; while (n != end.Next) { strRep.Append(n.StrRep()); origStrRep.Append(n.OriginalStrRep()); node.Annotation.FeatureStruct.Add(n.Annotation.FeatureStruct); n = n.Next; } node.Annotation.FeatureStruct.AddValue(CogFeatureSystem.StrRep, strRep.ToString()); node.Annotation.FeatureStruct.AddValue(CogFeatureSystem.OriginalStrRep, origStrRep.ToString()); node.Annotation.FeatureStruct.AddValue(CogFeatureSystem.SegmentType, CogFeatureSystem.Complex); FeatureStruct firstFS; if (start.IsComplex()) { firstFS = start.Annotation.FeatureStruct.GetValue(CogFeatureSystem.First); } else { firstFS = new FeatureStruct(); foreach (Feature feature in start.Annotation.FeatureStruct.Features.Where(f => !CogFeatureSystem.Instance.ContainsFeature(f))) firstFS.AddValue(feature, start.Annotation.FeatureStruct.GetValue(feature)); } node.Annotation.FeatureStruct.AddValue(CogFeatureSystem.First, firstFS); } else { ShapeNode n = start; while (n != end.Next) { var newNode = n.DeepClone(); node.AddAfter(newNode); node = newNode; n = n.Next; } } }
private static void MoveNodesAfter(Shape shape, ShapeNode cur, Span<ShapeNode> span) { foreach (ShapeNode node in shape.GetNodes(span).ToArray()) { if (node.Type() == HCFeatureSystem.Segment) { node.Remove(); cur.AddAfter(node); node.SetDirty(true); } cur = node; } }