/// <summary> /// Duplicates a source Translation into its target /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void DuplicateTranslation(Generated.Translation source, Generated.Translation target) { if ( source != null && target != null ) { DuplicateReferencesParagraph (source, target); target.setImplemented(source.getImplemented()); } }
/// <summary> /// Compares two Translation and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareTranslation(Generated.Translation obj, Generated.Translation 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.allSourceTexts() != null ) { if ( other.allSourceTexts() != null ) { foreach ( Generated.SourceText subElement in obj.allSourceTexts() ) { bool compared = false; foreach ( Generated.SourceText otherElement in other.allSourceTexts() ) { if ( subElement.Guid == otherElement.Guid ) { compareSourceText ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SourceTexts", "", subElement.Name ) ); } } foreach ( Generated.SourceText otherElement in other.allSourceTexts() ) { bool found = false; foreach ( Generated.SourceText subElement in obj.allSourceTexts() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SourceTexts", otherElement.Name) ); } } } else { foreach ( Generated.SourceText subElement in obj.allSourceTexts() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SourceTexts", "", subElement.Name ) ); } } } else { if ( other.allSourceTexts() != null ) { foreach ( Generated.SourceText otherElement in other.allSourceTexts() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SourceTexts", otherElement.Name) ); } } } if ( obj.getImplemented() != other.getImplemented() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Implemented", other.getImplemented().ToString(), obj.getImplemented().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) ); } } } }
/// <summary> /// Duplicates a source ReqRelated into its target /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void DuplicateReqRelated(Generated.ReqRelated source, Generated.ReqRelated target) { if ( source != null && target != null ) { DuplicateReferencesParagraph (source, target); target.setImplemented(source.getImplemented()); target.setVerified(source.getVerified()); target.setNeedsRequirement(source.getNeedsRequirement()); } }
/// <summary> /// Compares two ReqRelated and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareReqRelated(Generated.ReqRelated obj, Generated.ReqRelated 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.getImplemented() != other.getImplemented() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Implemented", other.getImplemented().ToString(), obj.getImplemented().ToString()) ); } if ( obj.getVerified() != other.getVerified() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Verified", other.getVerified().ToString(), obj.getVerified().ToString()) ); } if ( obj.getNeedsRequirement() != other.getNeedsRequirement() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "NeedsRequirement", other.getNeedsRequirement().ToString(), obj.getNeedsRequirement().ToString()) ); } }