|
6 | 6 | // This file holds the overrides of the generated classes for the Ling module. |
7 | 7 | // </remarks> |
8 | 8 |
|
9 | | -using System; |
10 | | -using System.Collections.Generic; |
11 | | -using System.Collections.Specialized; |
12 | | -using System.Diagnostics; |
13 | | -using System.Drawing; |
14 | | -using System.Globalization; |
15 | | -using System.Linq; |
16 | | -using System.Text; |
17 | | -using System.Text.RegularExpressions; |
18 | | -using System.Xml; |
19 | 9 | using SIL.LCModel.Application; |
20 | 10 | using SIL.LCModel.Core.Cellar; |
21 | 11 | using SIL.LCModel.Core.KernelInterfaces; |
|
27 | 17 | using SIL.LCModel.Infrastructure.Impl; |
28 | 18 | using SIL.LCModel.Utils; |
29 | 19 | using SIL.ObjectModel; |
| 20 | +using System; |
| 21 | +using System.Collections.Generic; |
| 22 | +using System.Collections.Specialized; |
| 23 | +using System.Diagnostics; |
| 24 | +using System.Drawing; |
| 25 | +using System.Globalization; |
| 26 | +using System.Linq; |
| 27 | +using System.Text; |
| 28 | +using System.Text.RegularExpressions; |
| 29 | +using System.Xml; |
30 | 30 |
|
31 | 31 | namespace SIL.LCModel.DomainImpl |
32 | 32 | { |
@@ -7528,7 +7528,7 @@ public int OrderNumber |
7528 | 7528 | } |
7529 | 7529 | } |
7530 | 7530 |
|
7531 | | - internal partial class PhRegularRule |
| 7531 | + internal partial class PhRegularRule : ICloneableCmObject |
7532 | 7532 | { |
7533 | 7533 | /// <summary> |
7534 | 7534 | /// Gets all of the feature constraints in this rule. |
@@ -7670,6 +7670,34 @@ protected override void RemoveObjectSideEffectsInternal(RemoveObjectEventArgs e) |
7670 | 7670 | } |
7671 | 7671 | } |
7672 | 7672 | } |
| 7673 | + |
| 7674 | + #region ICloneableCmObject Members |
| 7675 | + /// ------------------------------------------------------------------------------------ |
| 7676 | + /// <summary> |
| 7677 | + /// Clones this instance. |
| 7678 | + /// </summary> |
| 7679 | + /// <param name="clone">Destination object for clone operation</param> |
| 7680 | + /// ------------------------------------------------------------------------------------ |
| 7681 | + public void SetCloneProperties(ICmObject clone) |
| 7682 | + { |
| 7683 | + IPhRegularRule rule = clone as IPhRegularRule; |
| 7684 | + if (rule == null) |
| 7685 | + throw new ApplicationException("Failed to copy regular phonological rule: the target is not a regular phonological rule."); |
| 7686 | + |
| 7687 | + rule.Description.CopyAlternatives(Description); |
| 7688 | + rule.Direction = Direction; |
| 7689 | + rule.Disabled = Disabled; |
| 7690 | + rule.Name.CopyAlternatives(Name); |
| 7691 | + // FeatureConstraints is synthetic. |
| 7692 | + rule.FinalStratumRA = FinalStratumRA; |
| 7693 | + rule.InitialStratumRA = InitialStratumRA; |
| 7694 | + rule.RightHandSidesOS.Clear(); // Remove default. |
| 7695 | + CopyObject<IPhSegRuleRHS>.CloneLcmObjects(RightHandSidesOS, newRhs => |
| 7696 | + rule.RightHandSidesOS.Add(newRhs)); |
| 7697 | + CopyObject<IPhSimpleContext>.CloneLcmObjects(StrucDescOS, newDesc => |
| 7698 | + rule.StrucDescOS.Add(newDesc)); |
| 7699 | + } |
| 7700 | + #endregion |
7673 | 7701 | } |
7674 | 7702 |
|
7675 | 7703 | internal partial class PhSegRuleRHS |
@@ -7734,7 +7762,7 @@ private void CollectInflectionClassesAndSubclasses(List<ICmObject> result, IEnum |
7734 | 7762 | } |
7735 | 7763 | } |
7736 | 7764 |
|
7737 | | - internal partial class PhMetathesisRule |
| 7765 | + internal partial class PhMetathesisRule : ICloneableCmObject |
7738 | 7766 | { |
7739 | 7767 | /// <summary> |
7740 | 7768 | /// Gets the structural change indices. |
@@ -8135,6 +8163,32 @@ protected override void SetDefaultValuesAfterInit() |
8135 | 8163 | base.SetDefaultValuesAfterInit(); |
8136 | 8164 | SetStrucChangeIndices(new int[] { -1, -1, -1, -1, -1 }, true); |
8137 | 8165 | } |
| 8166 | + |
| 8167 | + #region ICloneableCmObject Members |
| 8168 | + /// ------------------------------------------------------------------------------------ |
| 8169 | + /// <summary> |
| 8170 | + /// Clones this instance. |
| 8171 | + /// </summary> |
| 8172 | + /// <param name="clone">Destination object for clone operation</param> |
| 8173 | + /// ------------------------------------------------------------------------------------ |
| 8174 | + public void SetCloneProperties(ICmObject clone) |
| 8175 | + { |
| 8176 | + IPhMetathesisRule rule = clone as IPhMetathesisRule; |
| 8177 | + if (rule == null) |
| 8178 | + throw new ApplicationException("Failed to copy metathesis phonological rule: the target is not a regular metathesis rule."); |
| 8179 | + |
| 8180 | + rule.Description.CopyAlternatives(Description); |
| 8181 | + rule.Direction = Direction; |
| 8182 | + rule.Disabled = Disabled; |
| 8183 | + rule.Name.CopyAlternatives(Name); |
| 8184 | + // FeatureConstraints is synthetic. |
| 8185 | + rule.FinalStratumRA = FinalStratumRA; |
| 8186 | + rule.InitialStratumRA = InitialStratumRA; |
| 8187 | + rule.StrucChange = StrucChange; |
| 8188 | + CopyObject<IPhSimpleContext>.CloneLcmObjects(StrucDescOS, newDesc => |
| 8189 | + rule.StrucDescOS.Add(newDesc)); |
| 8190 | + } |
| 8191 | + #endregion |
8138 | 8192 | } |
8139 | 8193 |
|
8140 | 8194 | internal partial class PhIterationContext |
|
0 commit comments