/// <summary> /// Cleans all text fields in this element /// </summary> /// <param name="obj"></param> /// <param name="visitSubNodes"></param> public override void visit(Generated.Step obj, bool visitSubNodes) { if ( obj.getDescription() != null ) { obj.setDescription(obj.getDescription().Trim()); } if ( obj.getObsoleteComment() != null ) { obj.setObsoleteComment(obj.getObsoleteComment().Trim()); } if ( obj.getUserComment() != null ) { obj.setUserComment(obj.getUserComment().Trim()); } base.visit(obj, visitSubNodes); }
/// <summary> /// Compares two Step and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareStep(Generated.Step obj, Generated.Step other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareReferencesParagraph (obj, other, diff); if ( obj.getTCS_Order() != other.getTCS_Order() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "TCS_Order", other.getTCS_Order().ToString(), obj.getTCS_Order().ToString()) ); } if ( obj.getDistance() != other.getDistance() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Distance", other.getDistance().ToString(), obj.getDistance().ToString()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getDescription(), other.getDescription()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Description", other.getDescription(), obj.getDescription()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getObsoleteComment(), other.getObsoleteComment()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "ObsoleteComment", other.getObsoleteComment(), obj.getObsoleteComment()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getUserComment(), other.getUserComment()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "UserComment", other.getUserComment(), obj.getUserComment()) ); } if ( obj.getIO() != other.getIO() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "IO", other.getIO().ToString(), obj.getIO().ToString()) ); } if ( obj.getInterface() != other.getInterface() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Interface", other.getInterface().ToString(), obj.getInterface().ToString()) ); } if ( obj.getLevelIN() != other.getLevelIN() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "LevelIN", other.getLevelIN().ToString(), obj.getLevelIN().ToString()) ); } if ( obj.getLevelOUT() != other.getLevelOUT() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "LevelOUT", other.getLevelOUT().ToString(), obj.getLevelOUT().ToString()) ); } if ( obj.getModeIN() != other.getModeIN() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "ModeIN", other.getModeIN().ToString(), obj.getModeIN().ToString()) ); } if ( obj.getModeOUT() != other.getModeOUT() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "ModeOUT", other.getModeOUT().ToString(), obj.getModeOUT().ToString()) ); } if ( obj.getTranslationRequired() != other.getTranslationRequired() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "TranslationRequired", other.getTranslationRequired().ToString(), obj.getTranslationRequired().ToString()) ); } if ( obj.getTranslated() != other.getTranslated() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Translated", other.getTranslated().ToString(), obj.getTranslated().ToString()) ); } if ( obj.allSubSteps() != null ) { if ( other.allSubSteps() != null ) { foreach ( Generated.SubStep subElement in obj.allSubSteps() ) { bool compared = false; foreach ( Generated.SubStep otherElement in other.allSubSteps() ) { if ( subElement.Guid == otherElement.Guid ) { compareSubStep ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubSteps", "", subElement.Name ) ); } } foreach ( Generated.SubStep otherElement in other.allSubSteps() ) { bool found = false; foreach ( Generated.SubStep subElement in obj.allSubSteps() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubSteps", otherElement.Name) ); } } } else { foreach ( Generated.SubStep subElement in obj.allSubSteps() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubSteps", "", subElement.Name ) ); } } } else { if ( other.allSubSteps() != null ) { foreach ( Generated.SubStep otherElement in other.allSubSteps() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubSteps", otherElement.Name) ); } } } if ( obj.allMessages() != null ) { if ( other.allMessages() != null ) { foreach ( Generated.DBMessage subElement in obj.allMessages() ) { bool compared = false; foreach ( Generated.DBMessage otherElement in other.allMessages() ) { if ( subElement.Guid == otherElement.Guid ) { compareDBMessage ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Messages", "", subElement.Name ) ); } } foreach ( Generated.DBMessage otherElement in other.allMessages() ) { bool found = false; foreach ( Generated.DBMessage subElement in obj.allMessages() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Messages", otherElement.Name) ); } } } else { foreach ( Generated.DBMessage subElement in obj.allMessages() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Messages", "", subElement.Name ) ); } } } else { if ( other.allMessages() != null ) { foreach ( Generated.DBMessage otherElement in other.allMessages() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Messages", otherElement.Name) ); } } } }
/// <summary> /// Duplicates a source Step into its target /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void DuplicateStep(Generated.Step source, Generated.Step target) { if ( source != null && target != null ) { DuplicateReferencesParagraph (source, target); target.setTCS_Order(source.getTCS_Order()); target.setDistance(source.getDistance()); target.setDescription(source.getDescription()); target.setObsoleteComment(source.getObsoleteComment()); target.setUserComment(source.getUserComment()); target.setIO(source.getIO()); target.setInterface(source.getInterface()); target.setLevelIN(source.getLevelIN()); target.setLevelOUT(source.getLevelOUT()); target.setModeIN(source.getModeIN()); target.setModeOUT(source.getModeOUT()); target.setTranslationRequired(source.getTranslationRequired()); target.setTranslated(source.getTranslated()); } }
/// <summary> /// Searches a specific string in Step and updates the list /// of model element with all the elements in which that string is found /// </summary> /// <param name="obj"></param> /// <param name="obj">The string to search for</param> /// <param name="occurences">The list of model elements which hold the searched string</param> public static void searchStep(Generated.Step obj, string searchString, List<ModelElement> occurences) { searchReferencesParagraph (obj, searchString, occurences); if ( obj.getDescription() != null && obj.getDescription().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.getObsoleteComment() != null && obj.getObsoleteComment().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.getUserComment() != null && obj.getUserComment().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.allSubSteps() != null ) { foreach ( Generated.SubStep subElement in obj.allSubSteps() ) { searchSubStep ( subElement, searchString, occurences ); } } if ( obj.allMessages() != null ) { foreach ( Generated.DBMessage subElement in obj.allMessages() ) { searchDBMessage ( subElement, searchString, occurences ); } } }