private static void ApplyAccessorChanges(Property existingProperty, Property exampleProperty, Actions actions) { if (existingProperty.GetAccessor == null) { actions.AddAction(new AddAccessorToPropertyAction(existingProperty, exampleProperty.GetAccessor)); } else if (exampleProperty.GetAccessor != null && existingProperty.GetAccessor.Modifier != exampleProperty.GetAccessor.Modifier) { actions.AddAction(new ChangePropertyAccessorModifierAction(existingProperty.GetAccessor, exampleProperty.GetAccessor.Modifier)); } if (existingProperty.SetAccessor == null) { actions.AddAction(new AddAccessorToPropertyAction(existingProperty, exampleProperty.SetAccessor)); } else if (exampleProperty.SetAccessor != null && existingProperty.SetAccessor.Modifier != exampleProperty.SetAccessor.Modifier) { actions.AddAction(new ChangePropertyAccessorModifierAction(existingProperty.SetAccessor, exampleProperty.SetAccessor.Modifier)); } }
private static void ApplyModifierChanges(Property existingProperty, Property exampleProperty, Actions actions) { if (existingProperty.Modifiers.UnorderedEqual(exampleProperty.Modifiers) == false) { actions.AddAction(new RemoveModifiersFromPropertyAction(existingProperty)); foreach (var modifier in exampleProperty.Modifiers) { actions.AddAction(new AddModifierToPropertyAction(existingProperty, modifier, false)); } } }
public RemovePropertyFromClassAction(Property propertyToDelete) { PropertyToDelete = propertyToDelete; }
public ChangeTypeOfPropertyAction(Property propertyToChange, DataType newName) { PropertyToChange = propertyToChange; NewType = newName; }
private Property Construct(Class @class) { Property prop = new Property(@class.Controller); prop.Name = _name; prop.Modifiers.AddRange(_Modifiers); prop.DataType = new DataType(@class.Controller, _typeName); if (string.IsNullOrEmpty(_getAccessor) == false) { prop.GetAccessor = new PropertyAccessor(@class.Controller, PropertyAccessor.AccessorTypes.Get) { BodyText = _getAccessor, Modifier = _getAccessorAccessibility, PreceedingBlankLines = -1 }; } if (string.IsNullOrEmpty(_setAccessor) == false) { prop.SetAccessor = new PropertyAccessor(@class.Controller, PropertyAccessor.AccessorTypes.Set) { BodyText = _setAccessor, Modifier = _setAccessorAccessibility, PreceedingBlankLines = -1 }; } return prop; }
public AddAccessorToPropertyAction(Property propertyToChange, PropertyAccessor newAccessor) { PropertyToChange = propertyToChange; NewAccessor = newAccessor; }
public void Property() { Property item = new Property(controller, "Property1", new DataType(controller, "int"), "public"); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("Property1")); Class cl = new Class(controller, "Class1"); cl.AddChild(item); Assert.That(item.FullyQualifiedDisplayName, Is.EqualTo("Class1.Property1")); }
private static void ApplyPropertyDeletion(Actions actions, Property existingProperty) { actions.AddAction(new RemovePropertyFromClassAction(existingProperty)); }
public RemoveModifierFromPropertyAction(Property propertyToChange, string modifierToRemove) { PropertyToChange = propertyToChange; ModifierToRemove = modifierToRemove; }
public void Property() { Property inter = new Property(controller); inter.Name = "File"; inter.Modifiers.Add("public"); inter.DataType = new DataType(controller,"int"); Assert.That(inter.IsTheSame(inter.Clone(), ComparisonDepth.Outer), Is.True); }
public RemoveAccessorFromPropertyAction(Property propertyToChange, PropertyAccessor accessorToRemove) { PropertyToChange = propertyToChange; AccessorToRemove = accessorToRemove; }
public VBPropertyPrinter(Property obj) { this.obj = obj; }
public RemoveModifiersFromPropertyAction(Property propertyToChange) { PropertyToChange = propertyToChange; }
private static void ApplyNameChanges(Property existingProperty, Property exampleProperty, Actions actions) { if (existingProperty.Name != exampleProperty.Name) { // Change datatype actions.AddAction(new ChangeNameOfPropertyAction(existingProperty, exampleProperty.Name)); } }
public void PropertyAccessor() { Property itp = new Property(controller, "Property1", new DataType(controller, "int"), "public"); PropertyAccessor item1 = new PropertyAccessor(controller, ArchAngel.Providers.CodeProvider.DotNet.PropertyAccessor.AccessorTypes.Get); PropertyAccessor item2 = new PropertyAccessor(controller, ArchAngel.Providers.CodeProvider.DotNet.PropertyAccessor.AccessorTypes.Set); itp.AddChild(item1); itp.AddChild(item2); Assert.That(item1.FullyQualifiedDisplayName, Is.EqualTo("Property1.Get Accessor")); Assert.That(item2.FullyQualifiedDisplayName, Is.EqualTo("Property1.Set Accessor")); Class it = new Class(controller, "Class1"); it.AddChild(itp); Assert.That(item1.FullyQualifiedDisplayName, Is.EqualTo("Class1.Property1.Get Accessor")); Assert.That(item2.FullyQualifiedDisplayName, Is.EqualTo("Class1.Property1.Set Accessor")); }
private static void ApplyPropertyChanges(Actions actions, Property existingProperty, Property exampleProperty) { ApplyNameChanges(existingProperty, exampleProperty, actions); ApplyModifierChanges(existingProperty, exampleProperty, actions); ApplyAccessorChanges(existingProperty, exampleProperty, actions); ApplyTypeChanges(existingProperty, exampleProperty, actions); }
public AddModifierToPropertyAction(Property propertyToChange, string newModifier, bool insertAtStart) { PropertyToChange = propertyToChange; NewModifier = newModifier; InsertAtStart = insertAtStart; }
private static void ApplyTypeChanges(Property existingProperty, Property exampleProperty, Actions actions) { if (exampleProperty.DataType != null && existingProperty.DataType.Equals(exampleProperty.DataType) == false) { // Change datatype actions.AddAction(new ChangeTypeOfPropertyAction(existingProperty, exampleProperty.DataType)); } }
public AddPropertyToClassAction(Property propertyToAdd, AdditionPoint additionPoint, Class classToAddTo) { ConstructToAdd = PropertyToAdd = propertyToAdd; AdditionPoint = additionPoint; ClassToAddTo = classToAddTo; }
public ChangeNameOfPropertyAction(Property propertyToChange, string newName) { PropertyToChange = propertyToChange; NewName = newName; }
public AddAttributeToPropertyAction(Property propertyToAddTo, Attribute attributeToAdd) { PropertyToAddTo = propertyToAddTo; AttributeToAdd = attributeToAdd; }