/// <summary> /// Constructor /// </summary> /// <param name="model"></param> public CheckNamingVisitor(BaseModelElement model) { DataDictionary.Generated.Namable namable = model as DataDictionary.Generated.Namable; if (namable != null) { visit(namable); } else { visit(model); } }
/// <summary> /// Updates the names of model elements to ensure that they match the defined naming convention /// </summary> /// <param name="obj"></param> /// <param name="visitSubNodes"></param> public override void visit(DataDictionary.Generated.Namable obj, bool visitSubNodes) { DataDictionary.Namable namable = (DataDictionary.Namable)obj; string newName = ""; if (namable is Parameter) { newName = EnsurePrefix(namable.Name, ParameterPrefix); } else if (namable is DataDictionary.Types.Structure) { DataDictionary.Types.Structure structure = (DataDictionary.Types.Structure)namable; if (structure.IsAbstract) { newName = EnsurePrefix(namable.Name, InterfacePrefix); } else { newName = EnsureSuffix(namable.Name, StructureSuffix); } } else if (namable is DataDictionary.Types.Enum) { newName = EnsureSuffix(namable.Name, EnumSuffix); } else if (namable is DataDictionary.Types.Collection) { newName = EnsureSuffix(namable.Name, CollectionSuffix); } else if (namable is DataDictionary.Types.StateMachine) { if (namable.Enclosing is DataDictionary.Types.NameSpace) { newName = EnsureSuffix(namable.Name, StateMachineSuffix); } } else if (namable is DataDictionary.Tests.Step) { newName = RemoveStepNumber(namable.Name); } if (!string.IsNullOrEmpty(newName)) { EfsSystem.Instance.Compiler.Refactor(obj, newName); } base.visit(obj, visitSubNodes); }
public virtual void visit(Namable obj, bool visitSubNodes) { visit ((BaseModelElement) obj, false); if (visitSubNodes){ IXmlBBase[] Subs = acceptor.subElements((IXmlBBase)obj); if (Subs != null){ for (int i=0; i<Subs.Length; i++) { dispatch(Subs[i], true); } // If } // If } }
public virtual void visit(Namable obj) { visit(obj, true); }
public void copyTo(Namable other) { base.copyTo(other); other.aName = aName; }
public void copyTo(Namable other) { other.aName = aName; }