/// <summary> /// Compares two Case and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareCase(Generated.Case obj, Generated.Case other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); if ( obj.allPreConditions() != null ) { if ( other.allPreConditions() != null ) { int i = 0; while ( i < obj.countPreConditions() && i < other.countPreConditions() ) { Generated.PreCondition element = obj.getPreConditions( i ); Generated.PreCondition otherElement = other.getPreConditions( i ); comparePreCondition ( element, otherElement, diff ); i += 1; } while ( i < obj.countPreConditions() ) { diff.appendChanges ( new Diff(obj.getPreConditions(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "PreConditions", "", obj.getPreConditions( i ).Name ) ); i += 1; } while ( i < other.countPreConditions() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "PreConditions", other.getPreConditions( i ).Name) ); i += 1; } } else { foreach ( Generated.PreCondition subElement in obj.allPreConditions() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "PreConditions", "", subElement.Name ) ); } } } else { if ( other.allPreConditions() != null ) { foreach ( Generated.PreCondition otherElement in other.allPreConditions() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "PreConditions", otherElement.Name) ); } } } if ( !CompareUtil.canonicalStringEquality(obj.getExpression(), other.getExpression()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Expression", other.getExpression(), obj.getExpression()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getComment(), other.getComment()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Comment", other.getComment(), obj.getComment()) ); } }
/// <summary> /// Compares two Action and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareAction(Generated.Action obj, Generated.Action other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } if ( !CompareUtil.canonicalStringEquality(obj.getExpression(), other.getExpression()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Expression", other.getExpression(), obj.getExpression()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getComment(), other.getComment()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Comment", other.getComment(), obj.getComment()) ); } }
/// <summary> /// Executes the comparison /// </summary> public override void ExecuteWork() { Dictionary otherVersion = DictionaryByVersion(Commit); // Compare the two dictionaries and mark the differences if (otherVersion != null) { VersionDiff versionDiff = new VersionDiff(); Comparer.ensureGuidDictionary(Dictionary, otherVersion); Comparer.compareDictionary(Dictionary, otherVersion, versionDiff); versionDiff.MarkVersionChanges(Dictionary); } else { MessageBox.Show("Cannot open file, please see log file (GUI.Log) for more information", "Cannot open file", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Compares the files /// </summary> public override void ExecuteWork() { // Open the dictionary but do not store it in the EFS System const bool allowErrors = true; OpenFileOperation openFileOperation = new OpenFileOperation(OtherFilePath, null, allowErrors, false); openFileOperation.ExecuteWork(); // Compare the files if (openFileOperation.Dictionary != null) { VersionDiff versionDiff = new VersionDiff(); Comparer.ensureGuidDictionary(Dictionary, openFileOperation.Dictionary); Comparer.compareDictionary(Dictionary, openFileOperation.Dictionary, versionDiff); versionDiff.MarkVersionChanges(Dictionary); } else { MessageBox.Show("Cannot open file, please see log file (GUI.Log) for more information", "Cannot open file", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Compares two RequirementSet and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareRequirementSet(Generated.RequirementSet obj, Generated.RequirementSet other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); if ( obj.allDependancies() != null ) { if ( other.allDependancies() != null ) { foreach ( Generated.RequirementSetDependancy subElement in obj.allDependancies() ) { bool compared = false; foreach ( Generated.RequirementSetDependancy otherElement in other.allDependancies() ) { if ( subElement.Guid == otherElement.Guid ) { compareRequirementSetDependancy ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Dependancies", "", subElement.Name ) ); } } foreach ( Generated.RequirementSetDependancy otherElement in other.allDependancies() ) { bool found = false; foreach ( Generated.RequirementSetDependancy subElement in obj.allDependancies() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Dependancies", otherElement.Name) ); } } } else { foreach ( Generated.RequirementSetDependancy subElement in obj.allDependancies() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Dependancies", "", subElement.Name ) ); } } } else { if ( other.allDependancies() != null ) { foreach ( Generated.RequirementSetDependancy otherElement in other.allDependancies() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Dependancies", otherElement.Name) ); } } } if ( obj.allSubSets() != null ) { if ( other.allSubSets() != null ) { foreach ( Generated.RequirementSet subElement in obj.allSubSets() ) { bool compared = false; foreach ( Generated.RequirementSet otherElement in other.allSubSets() ) { if ( subElement.Guid == otherElement.Guid ) { compareRequirementSet ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubSets", "", subElement.Name ) ); } } foreach ( Generated.RequirementSet otherElement in other.allSubSets() ) { bool found = false; foreach ( Generated.RequirementSet subElement in obj.allSubSets() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubSets", otherElement.Name) ); } } } else { foreach ( Generated.RequirementSet subElement in obj.allSubSets() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubSets", "", subElement.Name ) ); } } } else { if ( other.allSubSets() != null ) { foreach ( Generated.RequirementSet otherElement in other.allSubSets() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubSets", otherElement.Name) ); } } } if ( obj.getWidth() != other.getWidth() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Width", other.getWidth().ToString(), obj.getWidth().ToString()) ); } if ( obj.getHeight() != other.getHeight() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Height", other.getHeight().ToString(), obj.getHeight().ToString()) ); } if ( obj.getX() != other.getX() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "X", other.getX().ToString(), obj.getX().ToString()) ); } if ( obj.getY() != other.getY() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Y", other.getY().ToString(), obj.getY().ToString()) ); } if ( obj.getRecursiveSelection() != other.getRecursiveSelection() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "RecursiveSelection", other.getRecursiveSelection().ToString(), obj.getRecursiveSelection().ToString()) ); } if ( obj.getObsoleteRequirementsStatus() != other.getObsoleteRequirementsStatus() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "ObsoleteRequirementsStatus", other.getObsoleteRequirementsStatus().ToString(), obj.getObsoleteRequirementsStatus().ToString()) ); } if ( obj.getDefault() != other.getDefault() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Default", other.getDefault().ToString(), obj.getDefault().ToString()) ); } if ( obj.getPinned() != other.getPinned() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Pinned", other.getPinned().ToString(), obj.getPinned().ToString()) ); } }
/// <summary> /// Compares two StructureElement and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareStructureElement(Generated.StructureElement obj, Generated.StructureElement other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareReqRelated (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getTypeName(), other.getTypeName()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "TypeName", other.getTypeName(), obj.getTypeName()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getDefault(), other.getDefault()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Default", other.getDefault(), obj.getDefault()) ); } if ( obj.getMode() != other.getMode() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Mode", other.getMode().ToString(), obj.getMode().ToString()) ); } }
/// <summary> /// Compares two Variable and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareVariable(Generated.Variable obj, Generated.Variable other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareReqRelated (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getTypeName(), other.getTypeName()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "TypeName", other.getTypeName(), obj.getTypeName()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getDefaultValue(), other.getDefaultValue()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "DefaultValue", other.getDefaultValue(), obj.getDefaultValue()) ); } if ( obj.getVariableMode() != other.getVariableMode() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "VariableMode", other.getVariableMode().ToString(), obj.getVariableMode().ToString()) ); } if ( obj.allSubVariables() != null ) { if ( other.allSubVariables() != null ) { foreach ( Generated.Variable subElement in obj.allSubVariables() ) { bool compared = false; foreach ( Generated.Variable otherElement in other.allSubVariables() ) { if ( subElement.Guid == otherElement.Guid ) { compareVariable ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubVariables", "", subElement.Name ) ); } } foreach ( Generated.Variable otherElement in other.allSubVariables() ) { bool found = false; foreach ( Generated.Variable subElement in obj.allSubVariables() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubVariables", otherElement.Name) ); } } } else { foreach ( Generated.Variable subElement in obj.allSubVariables() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubVariables", "", subElement.Name ) ); } } } else { if ( other.allSubVariables() != null ) { foreach ( Generated.Variable otherElement in other.allSubVariables() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubVariables", otherElement.Name) ); } } } if ( obj.getWidth() != other.getWidth() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Width", other.getWidth().ToString(), obj.getWidth().ToString()) ); } if ( obj.getHeight() != other.getHeight() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Height", other.getHeight().ToString(), obj.getHeight().ToString()) ); } if ( obj.getX() != other.getX() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "X", other.getX().ToString(), obj.getX().ToString()) ); } if ( obj.getY() != other.getY() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Y", other.getY().ToString(), obj.getY().ToString()) ); } if ( obj.getHidden() != other.getHidden() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Hidden", other.getHidden().ToString(), obj.getHidden().ToString()) ); } if ( obj.getPinned() != other.getPinned() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Pinned", other.getPinned().ToString(), obj.getPinned().ToString()) ); } }
/// <summary> /// Compares two Enum and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareEnum(Generated.Enum obj, Generated.Enum other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareType (obj, other, diff); if ( obj.allValues() != null ) { if ( other.allValues() != null ) { int i = 0; while ( i < obj.countValues() && i < other.countValues() ) { Generated.EnumValue element = obj.getValues( i ); Generated.EnumValue otherElement = other.getValues( i ); compareEnumValue ( element, otherElement, diff ); i += 1; } while ( i < obj.countValues() ) { diff.appendChanges ( new Diff(obj.getValues(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Values", "", obj.getValues( i ).Name ) ); i += 1; } while ( i < other.countValues() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "Values", other.getValues( i ).Name) ); i += 1; } } else { foreach ( Generated.EnumValue subElement in obj.allValues() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Values", "", subElement.Name ) ); } } } else { if ( other.allValues() != null ) { foreach ( Generated.EnumValue otherElement in other.allValues() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Values", otherElement.Name) ); } } } if ( obj.allSubEnums() != null ) { if ( other.allSubEnums() != null ) { foreach ( Generated.Enum subElement in obj.allSubEnums() ) { bool compared = false; foreach ( Generated.Enum otherElement in other.allSubEnums() ) { if ( subElement.Guid == otherElement.Guid ) { compareEnum ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubEnums", "", subElement.Name ) ); } } foreach ( Generated.Enum otherElement in other.allSubEnums() ) { bool found = false; foreach ( Generated.Enum subElement in obj.allSubEnums() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubEnums", otherElement.Name) ); } } } else { foreach ( Generated.Enum subElement in obj.allSubEnums() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubEnums", "", subElement.Name ) ); } } } else { if ( other.allSubEnums() != null ) { foreach ( Generated.Enum otherElement in other.allSubEnums() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubEnums", otherElement.Name) ); } } } }
/// <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> /// Compares two TranslationDictionary and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareTranslationDictionary(Generated.TranslationDictionary obj, Generated.TranslationDictionary other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); if ( obj.allFolders() != null ) { if ( other.allFolders() != null ) { foreach ( Generated.Folder subElement in obj.allFolders() ) { bool compared = false; foreach ( Generated.Folder otherElement in other.allFolders() ) { if ( subElement.Guid == otherElement.Guid ) { compareFolder ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Folders", "", subElement.Name ) ); } } foreach ( Generated.Folder otherElement in other.allFolders() ) { bool found = false; foreach ( Generated.Folder subElement in obj.allFolders() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Folders", otherElement.Name) ); } } } else { foreach ( Generated.Folder subElement in obj.allFolders() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Folders", "", subElement.Name ) ); } } } else { if ( other.allFolders() != null ) { foreach ( Generated.Folder otherElement in other.allFolders() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Folders", otherElement.Name) ); } } } if ( obj.allTranslations() != null ) { if ( other.allTranslations() != null ) { foreach ( Generated.Translation subElement in obj.allTranslations() ) { bool compared = false; foreach ( Generated.Translation otherElement in other.allTranslations() ) { if ( subElement.Guid == otherElement.Guid ) { compareTranslation ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Translations", "", subElement.Name ) ); } } foreach ( Generated.Translation otherElement in other.allTranslations() ) { bool found = false; foreach ( Generated.Translation subElement in obj.allTranslations() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Translations", otherElement.Name) ); } } } else { foreach ( Generated.Translation subElement in obj.allTranslations() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Translations", "", subElement.Name ) ); } } } else { if ( other.allTranslations() != null ) { foreach ( Generated.Translation otherElement in other.allTranslations() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Translations", otherElement.Name) ); } } } }
/// <summary> /// Compares two Specification and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareSpecification(Generated.Specification obj, Generated.Specification other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getVersion(), other.getVersion()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Version", other.getVersion(), obj.getVersion()) ); } if ( obj.allChapters() != null ) { if ( other.allChapters() != null ) { foreach ( Generated.Chapter subElement in obj.allChapters() ) { bool compared = false; foreach ( Generated.Chapter otherElement in other.allChapters() ) { if ( subElement.Guid == otherElement.Guid ) { compareChapter ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Chapters", "", subElement.Name ) ); } } foreach ( Generated.Chapter otherElement in other.allChapters() ) { bool found = false; foreach ( Generated.Chapter subElement in obj.allChapters() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Chapters", otherElement.Name) ); } } } else { foreach ( Generated.Chapter subElement in obj.allChapters() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Chapters", "", subElement.Name ) ); } } } else { if ( other.allChapters() != null ) { foreach ( Generated.Chapter otherElement in other.allChapters() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Chapters", otherElement.Name) ); } } } if ( obj.allChapterRefs() != null ) { if ( other.allChapterRefs() != null ) { foreach ( Generated.ChapterRef subElement in obj.allChapterRefs() ) { bool compared = false; foreach ( Generated.ChapterRef otherElement in other.allChapterRefs() ) { if ( subElement.Guid == otherElement.Guid ) { compareChapterRef ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "ChapterRefs", "", subElement.Name ) ); } } foreach ( Generated.ChapterRef otherElement in other.allChapterRefs() ) { bool found = false; foreach ( Generated.ChapterRef subElement in obj.allChapterRefs() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "ChapterRefs", otherElement.Name) ); } } } else { foreach ( Generated.ChapterRef subElement in obj.allChapterRefs() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "ChapterRefs", "", subElement.Name ) ); } } } else { if ( other.allChapterRefs() != null ) { foreach ( Generated.ChapterRef otherElement in other.allChapterRefs() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "ChapterRefs", otherElement.Name) ); } } } }
/// <summary> /// Compares two SubStep and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareSubStep(Generated.SubStep obj, Generated.SubStep other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); if ( obj.allActions() != null ) { if ( other.allActions() != null ) { int i = 0; while ( i < obj.countActions() && i < other.countActions() ) { Generated.Action element = obj.getActions( i ); Generated.Action otherElement = other.getActions( i ); compareAction ( element, otherElement, diff ); i += 1; } while ( i < obj.countActions() ) { diff.appendChanges ( new Diff(obj.getActions(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Actions", "", obj.getActions( i ).Name ) ); i += 1; } while ( i < other.countActions() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "Actions", other.getActions( i ).Name) ); i += 1; } } else { foreach ( Generated.Action subElement in obj.allActions() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Actions", "", subElement.Name ) ); } } } else { if ( other.allActions() != null ) { foreach ( Generated.Action otherElement in other.allActions() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Actions", otherElement.Name) ); } } } if ( obj.allExpectations() != null ) { if ( other.allExpectations() != null ) { int i = 0; while ( i < obj.countExpectations() && i < other.countExpectations() ) { Generated.Expectation element = obj.getExpectations( i ); Generated.Expectation otherElement = other.getExpectations( i ); compareExpectation ( element, otherElement, diff ); i += 1; } while ( i < obj.countExpectations() ) { diff.appendChanges ( new Diff(obj.getExpectations(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Expectations", "", obj.getExpectations( i ).Name ) ); i += 1; } while ( i < other.countExpectations() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "Expectations", other.getExpectations( i ).Name) ); i += 1; } } else { foreach ( Generated.Expectation subElement in obj.allExpectations() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Expectations", "", subElement.Name ) ); } } } else { if ( other.allExpectations() != null ) { foreach ( Generated.Expectation otherElement in other.allExpectations() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Expectations", otherElement.Name) ); } } } if ( obj.getSkipEngine() != other.getSkipEngine() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "SkipEngine", other.getSkipEngine().ToString(), obj.getSkipEngine().ToString()) ); } if ( obj.getTimeDelay() != other.getTimeDelay() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "TimeDelay", other.getTimeDelay().ToString(), obj.getTimeDelay().ToString()) ); } if ( obj.getTimer() != other.getTimer() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Timer", other.getTimer().ToString(), obj.getTimer().ToString()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getComment(), other.getComment()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Comment", other.getComment(), obj.getComment()) ); } }
/// <summary> /// Compares two RuleDisabling and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareRuleDisabling(Generated.RuleDisabling obj, Generated.RuleDisabling other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareReqRelated (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getRule(), other.getRule()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Rule", other.getRule(), obj.getRule()) ); } }
/// <summary> /// Compares two Shortcut and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareShortcut(Generated.Shortcut obj, Generated.Shortcut other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getShortcutName(), other.getShortcutName()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "ShortcutName", other.getShortcutName(), obj.getShortcutName()) ); } }
/// <summary> /// Compares two RuleCondition and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareRuleCondition(Generated.RuleCondition obj, Generated.RuleCondition other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareReqRelated (obj, other, diff); if ( obj.allPreConditions() != null ) { if ( other.allPreConditions() != null ) { int i = 0; while ( i < obj.countPreConditions() && i < other.countPreConditions() ) { Generated.PreCondition element = obj.getPreConditions( i ); Generated.PreCondition otherElement = other.getPreConditions( i ); comparePreCondition ( element, otherElement, diff ); i += 1; } while ( i < obj.countPreConditions() ) { diff.appendChanges ( new Diff(obj.getPreConditions(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "PreConditions", "", obj.getPreConditions( i ).Name ) ); i += 1; } while ( i < other.countPreConditions() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "PreConditions", other.getPreConditions( i ).Name) ); i += 1; } } else { foreach ( Generated.PreCondition subElement in obj.allPreConditions() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "PreConditions", "", subElement.Name ) ); } } } else { if ( other.allPreConditions() != null ) { foreach ( Generated.PreCondition otherElement in other.allPreConditions() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "PreConditions", otherElement.Name) ); } } } if ( obj.allActions() != null ) { if ( other.allActions() != null ) { int i = 0; while ( i < obj.countActions() && i < other.countActions() ) { Generated.Action element = obj.getActions( i ); Generated.Action otherElement = other.getActions( i ); compareAction ( element, otherElement, diff ); i += 1; } while ( i < obj.countActions() ) { diff.appendChanges ( new Diff(obj.getActions(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Actions", "", obj.getActions( i ).Name ) ); i += 1; } while ( i < other.countActions() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "Actions", other.getActions( i ).Name) ); i += 1; } } else { foreach ( Generated.Action subElement in obj.allActions() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Actions", "", subElement.Name ) ); } } } else { if ( other.allActions() != null ) { foreach ( Generated.Action otherElement in other.allActions() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Actions", otherElement.Name) ); } } } if ( obj.allSubRules() != null ) { if ( other.allSubRules() != null ) { foreach ( Generated.Rule subElement in obj.allSubRules() ) { bool compared = false; foreach ( Generated.Rule otherElement in other.allSubRules() ) { if ( subElement.Guid == otherElement.Guid ) { compareRule ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubRules", "", subElement.Name ) ); } } foreach ( Generated.Rule otherElement in other.allSubRules() ) { bool found = false; foreach ( Generated.Rule subElement in obj.allSubRules() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubRules", otherElement.Name) ); } } } else { foreach ( Generated.Rule subElement in obj.allSubRules() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubRules", "", subElement.Name ) ); } } } else { if ( other.allSubRules() != null ) { foreach ( Generated.Rule otherElement in other.allSubRules() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubRules", otherElement.Name) ); } } } }
/// <summary> /// Compares two Rule and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareRule(Generated.Rule obj, Generated.Rule other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareReqRelated (obj, other, diff); if ( obj.getPriority() != other.getPriority() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Priority", other.getPriority().ToString(), obj.getPriority().ToString()) ); } if ( obj.allConditions() != null ) { if ( other.allConditions() != null ) { foreach ( Generated.RuleCondition subElement in obj.allConditions() ) { bool compared = false; foreach ( Generated.RuleCondition otherElement in other.allConditions() ) { if ( subElement.Guid == otherElement.Guid ) { compareRuleCondition ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Conditions", "", subElement.Name ) ); } } foreach ( Generated.RuleCondition otherElement in other.allConditions() ) { bool found = false; foreach ( Generated.RuleCondition subElement in obj.allConditions() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Conditions", otherElement.Name) ); } } } else { foreach ( Generated.RuleCondition subElement in obj.allConditions() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Conditions", "", subElement.Name ) ); } } } else { if ( other.allConditions() != null ) { foreach ( Generated.RuleCondition otherElement in other.allConditions() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Conditions", otherElement.Name) ); } } } if ( obj.getWidth() != other.getWidth() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Width", other.getWidth().ToString(), obj.getWidth().ToString()) ); } if ( obj.getHeight() != other.getHeight() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Height", other.getHeight().ToString(), obj.getHeight().ToString()) ); } if ( obj.getX() != other.getX() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "X", other.getX().ToString(), obj.getX().ToString()) ); } if ( obj.getY() != other.getY() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Y", other.getY().ToString(), obj.getY().ToString()) ); } if ( obj.getHidden() != other.getHidden() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Hidden", other.getHidden().ToString(), obj.getHidden().ToString()) ); } if ( obj.getPinned() != other.getPinned() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Pinned", other.getPinned().ToString(), obj.getPinned().ToString()) ); } }
/// <summary> /// Compares two RequirementSetReference and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareRequirementSetReference(Generated.RequirementSetReference obj, Generated.RequirementSetReference other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } if ( !CompareUtil.canonicalStringEquality(obj.getTarget(), other.getTarget()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Target", other.getTarget(), obj.getTarget()) ); } }
/// <summary> /// Compares two StructureRef and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareStructureRef(Generated.StructureRef obj, Generated.StructureRef other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); }
/// <summary> /// Compares two ReferencesParagraph and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareReferencesParagraph(Generated.ReferencesParagraph obj, Generated.ReferencesParagraph other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); if ( obj.allRequirements() != null ) { if ( other.allRequirements() != null ) { foreach ( Generated.ReqRef subElement in obj.allRequirements() ) { bool compared = false; foreach ( Generated.ReqRef otherElement in other.allRequirements() ) { if ( subElement.Guid == otherElement.Guid ) { compareReqRef ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Requirements", "", subElement.Name ) ); } } foreach ( Generated.ReqRef otherElement in other.allRequirements() ) { bool found = false; foreach ( Generated.ReqRef subElement in obj.allRequirements() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Requirements", otherElement.Name) ); } } } else { foreach ( Generated.ReqRef subElement in obj.allRequirements() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Requirements", "", subElement.Name ) ); } } } else { if ( other.allRequirements() != null ) { foreach ( Generated.ReqRef otherElement in other.allRequirements() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Requirements", otherElement.Name) ); } } } if ( !CompareUtil.canonicalStringEquality(obj.getComment(), other.getComment()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Comment", other.getComment(), obj.getComment()) ); } }
/// <summary> /// Compares two SubSequence and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareSubSequence(Generated.SubSequence obj, Generated.SubSequence other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getD_LRBG(), other.getD_LRBG()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "D_LRBG", other.getD_LRBG(), obj.getD_LRBG()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getLevel(), other.getLevel()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Level", other.getLevel(), obj.getLevel()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getMode(), other.getMode()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Mode", other.getMode(), obj.getMode()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getNID_LRBG(), other.getNID_LRBG()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "NID_LRBG", other.getNID_LRBG(), obj.getNID_LRBG()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getQ_DIRLRBG(), other.getQ_DIRLRBG()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Q_DIRLRBG", other.getQ_DIRLRBG(), obj.getQ_DIRLRBG()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getQ_DIRTRAIN(), other.getQ_DIRTRAIN()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Q_DIRTRAIN", other.getQ_DIRTRAIN(), obj.getQ_DIRTRAIN()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getQ_DLRBG(), other.getQ_DLRBG()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Q_DLRBG", other.getQ_DLRBG(), obj.getQ_DLRBG()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getRBC_ID(), other.getRBC_ID()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "RBC_ID", other.getRBC_ID(), obj.getRBC_ID()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getRBCPhone(), other.getRBCPhone()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "RBCPhone", other.getRBCPhone(), obj.getRBCPhone()) ); } if ( obj.allTestCases() != null ) { if ( other.allTestCases() != null ) { foreach ( Generated.TestCase subElement in obj.allTestCases() ) { bool compared = false; foreach ( Generated.TestCase otherElement in other.allTestCases() ) { if ( subElement.Guid == otherElement.Guid ) { compareTestCase ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "TestCases", "", subElement.Name ) ); } } foreach ( Generated.TestCase otherElement in other.allTestCases() ) { bool found = false; foreach ( Generated.TestCase subElement in obj.allTestCases() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "TestCases", otherElement.Name) ); } } } else { foreach ( Generated.TestCase subElement in obj.allTestCases() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "TestCases", "", subElement.Name ) ); } } } else { if ( other.allTestCases() != null ) { foreach ( Generated.TestCase otherElement in other.allTestCases() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "TestCases", otherElement.Name) ); } } } if ( !CompareUtil.canonicalStringEquality(obj.getComment(), other.getComment()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Comment", other.getComment(), obj.getComment()) ); } if ( obj.getCompleted() != other.getCompleted() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Completed", other.getCompleted().ToString(), obj.getCompleted().ToString()) ); } }
/// <summary> /// Compares two State and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareState(Generated.State obj, Generated.State other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareReqRelated (obj, other, diff); if ( obj.getStateMachine() == null ) { if ( other.getStateMachine() != null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "StateMachine", "" ) ); } } else { compareStateMachine ( obj.getStateMachine(), other.getStateMachine(), diff ); } if ( obj.getWidth() != other.getWidth() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Width", other.getWidth().ToString(), obj.getWidth().ToString()) ); } if ( obj.getHeight() != other.getHeight() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Height", other.getHeight().ToString(), obj.getHeight().ToString()) ); } if ( obj.getX() != other.getX() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "X", other.getX().ToString(), obj.getX().ToString()) ); } if ( obj.getY() != other.getY() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Y", other.getY().ToString(), obj.getY().ToString()) ); } if ( obj.getPinned() != other.getPinned() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Pinned", other.getPinned().ToString(), obj.getPinned().ToString()) ); } if ( obj.getEnterAction() == null ) { if ( other.getEnterAction() != null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "EnterAction", "" ) ); } } else { compareRule ( obj.getEnterAction(), other.getEnterAction(), diff ); } if ( obj.getLeaveAction() == null ) { if ( other.getLeaveAction() != null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "LeaveAction", "" ) ); } } else { compareRule ( obj.getLeaveAction(), other.getLeaveAction(), diff ); } }
/// <summary> /// Compares two TestCase and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareTestCase(Generated.TestCase obj, Generated.TestCase other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareReqRelated (obj, other, diff); if ( obj.getFeature() != other.getFeature() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Feature", other.getFeature().ToString(), obj.getFeature().ToString()) ); } if ( obj.getCase() != other.getCase() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Case", other.getCase().ToString(), obj.getCase().ToString()) ); } if ( obj.allSteps() != null ) { if ( other.allSteps() != null ) { foreach ( Generated.Step subElement in obj.allSteps() ) { bool compared = false; foreach ( Generated.Step otherElement in other.allSteps() ) { if ( subElement.Guid == otherElement.Guid ) { compareStep ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Steps", "", subElement.Name ) ); } } foreach ( Generated.Step otherElement in other.allSteps() ) { bool found = false; foreach ( Generated.Step subElement in obj.allSteps() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Steps", otherElement.Name) ); } } } else { foreach ( Generated.Step subElement in obj.allSteps() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Steps", "", subElement.Name ) ); } } } else { if ( other.allSteps() != null ) { foreach ( Generated.Step otherElement in other.allSteps() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Steps", otherElement.Name) ); } } } }
/// <summary> /// Compares two StateMachine and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareStateMachine(Generated.StateMachine obj, Generated.StateMachine other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareType (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getInitialState(), other.getInitialState()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "InitialState", other.getInitialState(), obj.getInitialState()) ); } if ( obj.allStates() != null ) { if ( other.allStates() != null ) { foreach ( Generated.State subElement in obj.allStates() ) { bool compared = false; foreach ( Generated.State otherElement in other.allStates() ) { if ( subElement.Guid == otherElement.Guid ) { compareState ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "States", "", subElement.Name ) ); } } foreach ( Generated.State otherElement in other.allStates() ) { bool found = false; foreach ( Generated.State subElement in obj.allStates() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "States", otherElement.Name) ); } } } else { foreach ( Generated.State subElement in obj.allStates() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "States", "", subElement.Name ) ); } } } else { if ( other.allStates() != null ) { foreach ( Generated.State otherElement in other.allStates() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "States", otherElement.Name) ); } } } if ( obj.allRules() != null ) { if ( other.allRules() != null ) { foreach ( Generated.Rule subElement in obj.allRules() ) { bool compared = false; foreach ( Generated.Rule otherElement in other.allRules() ) { if ( subElement.Guid == otherElement.Guid ) { compareRule ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Rules", "", subElement.Name ) ); } } foreach ( Generated.Rule otherElement in other.allRules() ) { bool found = false; foreach ( Generated.Rule subElement in obj.allRules() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Rules", otherElement.Name) ); } } } else { foreach ( Generated.Rule subElement in obj.allRules() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Rules", "", subElement.Name ) ); } } } else { if ( other.allRules() != null ) { foreach ( Generated.Rule otherElement in other.allRules() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Rules", otherElement.Name) ); } } } }
/// <summary> /// Compares two Dictionary and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareDictionary(Generated.Dictionary obj, Generated.Dictionary other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } if ( obj.allSpecifications() != null ) { if ( other.allSpecifications() != null ) { foreach ( Generated.Specification subElement in obj.allSpecifications() ) { bool compared = false; foreach ( Generated.Specification otherElement in other.allSpecifications() ) { if ( subElement.Guid == otherElement.Guid ) { compareSpecification ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Specifications", "", subElement.Name ) ); } } foreach ( Generated.Specification otherElement in other.allSpecifications() ) { bool found = false; foreach ( Generated.Specification subElement in obj.allSpecifications() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Specifications", otherElement.Name) ); } } } else { foreach ( Generated.Specification subElement in obj.allSpecifications() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Specifications", "", subElement.Name ) ); } } } else { if ( other.allSpecifications() != null ) { foreach ( Generated.Specification otherElement in other.allSpecifications() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Specifications", otherElement.Name) ); } } } if ( obj.allRequirementSets() != null ) { if ( other.allRequirementSets() != null ) { foreach ( Generated.RequirementSet subElement in obj.allRequirementSets() ) { bool compared = false; foreach ( Generated.RequirementSet otherElement in other.allRequirementSets() ) { if ( subElement.Guid == otherElement.Guid ) { compareRequirementSet ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "RequirementSets", "", subElement.Name ) ); } } foreach ( Generated.RequirementSet otherElement in other.allRequirementSets() ) { bool found = false; foreach ( Generated.RequirementSet subElement in obj.allRequirementSets() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "RequirementSets", otherElement.Name) ); } } } else { foreach ( Generated.RequirementSet subElement in obj.allRequirementSets() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "RequirementSets", "", subElement.Name ) ); } } } else { if ( other.allRequirementSets() != null ) { foreach ( Generated.RequirementSet otherElement in other.allRequirementSets() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "RequirementSets", otherElement.Name) ); } } } if ( obj.allRuleDisablings() != null ) { if ( other.allRuleDisablings() != null ) { foreach ( Generated.RuleDisabling subElement in obj.allRuleDisablings() ) { bool compared = false; foreach ( Generated.RuleDisabling otherElement in other.allRuleDisablings() ) { if ( subElement.Guid == otherElement.Guid ) { compareRuleDisabling ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "RuleDisablings", "", subElement.Name ) ); } } foreach ( Generated.RuleDisabling otherElement in other.allRuleDisablings() ) { bool found = false; foreach ( Generated.RuleDisabling subElement in obj.allRuleDisablings() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "RuleDisablings", otherElement.Name) ); } } } else { foreach ( Generated.RuleDisabling subElement in obj.allRuleDisablings() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "RuleDisablings", "", subElement.Name ) ); } } } else { if ( other.allRuleDisablings() != null ) { foreach ( Generated.RuleDisabling otherElement in other.allRuleDisablings() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "RuleDisablings", otherElement.Name) ); } } } if ( obj.allNameSpaces() != null ) { if ( other.allNameSpaces() != null ) { foreach ( Generated.NameSpace subElement in obj.allNameSpaces() ) { bool compared = false; foreach ( Generated.NameSpace otherElement in other.allNameSpaces() ) { if ( subElement.Guid == otherElement.Guid ) { compareNameSpace ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "NameSpaces", "", subElement.Name ) ); } } foreach ( Generated.NameSpace otherElement in other.allNameSpaces() ) { bool found = false; foreach ( Generated.NameSpace subElement in obj.allNameSpaces() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "NameSpaces", otherElement.Name) ); } } } else { foreach ( Generated.NameSpace subElement in obj.allNameSpaces() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "NameSpaces", "", subElement.Name ) ); } } } else { if ( other.allNameSpaces() != null ) { foreach ( Generated.NameSpace otherElement in other.allNameSpaces() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "NameSpaces", otherElement.Name) ); } } } if ( obj.allNameSpaceRefs() != null ) { if ( other.allNameSpaceRefs() != null ) { foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() ) { bool compared = false; foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() ) { if ( subElement.Guid == otherElement.Guid ) { compareNameSpaceRef ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "NameSpaceRefs", "", subElement.Name ) ); } } foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() ) { bool found = false; foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "NameSpaceRefs", otherElement.Name) ); } } } else { foreach ( Generated.NameSpaceRef subElement in obj.allNameSpaceRefs() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "NameSpaceRefs", "", subElement.Name ) ); } } } else { if ( other.allNameSpaceRefs() != null ) { foreach ( Generated.NameSpaceRef otherElement in other.allNameSpaceRefs() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "NameSpaceRefs", otherElement.Name) ); } } } if ( obj.allTests() != null ) { if ( other.allTests() != null ) { foreach ( Generated.Frame subElement in obj.allTests() ) { bool compared = false; foreach ( Generated.Frame otherElement in other.allTests() ) { if ( subElement.Guid == otherElement.Guid ) { compareFrame ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Tests", "", subElement.Name ) ); } } foreach ( Generated.Frame otherElement in other.allTests() ) { bool found = false; foreach ( Generated.Frame subElement in obj.allTests() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Tests", otherElement.Name) ); } } } else { foreach ( Generated.Frame subElement in obj.allTests() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Tests", "", subElement.Name ) ); } } } else { if ( other.allTests() != null ) { foreach ( Generated.Frame otherElement in other.allTests() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Tests", otherElement.Name) ); } } } if ( obj.allTestRefs() != null ) { if ( other.allTestRefs() != null ) { foreach ( Generated.FrameRef subElement in obj.allTestRefs() ) { bool compared = false; foreach ( Generated.FrameRef otherElement in other.allTestRefs() ) { if ( subElement.Guid == otherElement.Guid ) { compareFrameRef ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "TestRefs", "", subElement.Name ) ); } } foreach ( Generated.FrameRef otherElement in other.allTestRefs() ) { bool found = false; foreach ( Generated.FrameRef subElement in obj.allTestRefs() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "TestRefs", otherElement.Name) ); } } } else { foreach ( Generated.FrameRef subElement in obj.allTestRefs() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "TestRefs", "", subElement.Name ) ); } } } else { if ( other.allTestRefs() != null ) { foreach ( Generated.FrameRef otherElement in other.allTestRefs() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "TestRefs", otherElement.Name) ); } } } if ( obj.getTranslationDictionary() == null ) { if ( other.getTranslationDictionary() != null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "TranslationDictionary", "" ) ); } } else { compareTranslationDictionary ( obj.getTranslationDictionary(), other.getTranslationDictionary(), diff ); } if ( obj.getShortcutDictionary() == null ) { if ( other.getShortcutDictionary() != null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "ShortcutDictionary", "" ) ); } } else { compareShortcutDictionary ( obj.getShortcutDictionary(), other.getShortcutDictionary(), diff ); } if ( !CompareUtil.canonicalStringEquality(obj.getXsi(), other.getXsi()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Xsi", other.getXsi(), obj.getXsi()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getXsiLocation(), other.getXsiLocation()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "XsiLocation", other.getXsiLocation(), obj.getXsiLocation()) ); } }
public override Commit createCommit() { VersionDiff retVal = new VersionDiff(); return(retVal); }
/// <summary> /// Compares two Type and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareType(Generated.Type obj, Generated.Type other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareReqRelated (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getDefault(), other.getDefault()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Default", other.getDefault(), obj.getDefault()) ); } if ( obj.getWidth() != other.getWidth() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Width", other.getWidth().ToString(), obj.getWidth().ToString()) ); } if ( obj.getHeight() != other.getHeight() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Height", other.getHeight().ToString(), obj.getHeight().ToString()) ); } if ( obj.getX() != other.getX() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "X", other.getX().ToString(), obj.getX().ToString()) ); } if ( obj.getY() != other.getY() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Y", other.getY().ToString(), obj.getY().ToString()) ); } if ( obj.getHidden() != other.getHidden() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Hidden", other.getHidden().ToString(), obj.getHidden().ToString()) ); } if ( obj.getPinned() != other.getPinned() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Pinned", other.getPinned().ToString(), obj.getPinned().ToString()) ); } }
/// <summary> /// Compares two DBPacket and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareDBPacket(Generated.DBPacket obj, Generated.DBPacket other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareNamable (obj, other, diff); if ( obj.allFields() != null ) { if ( other.allFields() != null ) { foreach ( Generated.DBField subElement in obj.allFields() ) { bool compared = false; foreach ( Generated.DBField otherElement in other.allFields() ) { if ( subElement.Guid == otherElement.Guid ) { compareDBField ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Fields", "", subElement.Name ) ); } } foreach ( Generated.DBField otherElement in other.allFields() ) { bool found = false; foreach ( Generated.DBField subElement in obj.allFields() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Fields", otherElement.Name) ); } } } else { foreach ( Generated.DBField subElement in obj.allFields() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Fields", "", subElement.Name ) ); } } } else { if ( other.allFields() != null ) { foreach ( Generated.DBField otherElement in other.allFields() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Fields", otherElement.Name) ); } } } }
/// <summary> /// Compares two Range and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareRange(Generated.Range obj, Generated.Range other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareType (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getMinValue(), other.getMinValue()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "MinValue", other.getMinValue(), obj.getMinValue()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getMaxValue(), other.getMaxValue()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "MaxValue", other.getMaxValue(), obj.getMaxValue()) ); } if ( obj.allSpecialValues() != null ) { if ( other.allSpecialValues() != null ) { int i = 0; while ( i < obj.countSpecialValues() && i < other.countSpecialValues() ) { Generated.EnumValue element = obj.getSpecialValues( i ); Generated.EnumValue otherElement = other.getSpecialValues( i ); compareEnumValue ( element, otherElement, diff ); i += 1; } while ( i < obj.countSpecialValues() ) { diff.appendChanges ( new Diff(obj.getSpecialValues(i), HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SpecialValues", "", obj.getSpecialValues( i ).Name ) ); i += 1; } while ( i < other.countSpecialValues() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove, "SpecialValues", other.getSpecialValues( i ).Name) ); i += 1; } } else { foreach ( Generated.EnumValue subElement in obj.allSpecialValues() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SpecialValues", "", subElement.Name ) ); } } } else { if ( other.allSpecialValues() != null ) { foreach ( Generated.EnumValue otherElement in other.allSpecialValues() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SpecialValues", otherElement.Name) ); } } } if ( obj.getPrecision() != other.getPrecision() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Precision", other.getPrecision().ToString(), obj.getPrecision().ToString()) ); } }
/// <summary> /// Compares two Structure and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareStructure(Generated.Structure obj, Generated.Structure other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareType (obj, other, diff); if ( obj.allElements() != null ) { if ( other.allElements() != null ) { foreach ( Generated.StructureElement subElement in obj.allElements() ) { bool compared = false; foreach ( Generated.StructureElement otherElement in other.allElements() ) { if ( subElement.Guid == otherElement.Guid ) { compareStructureElement ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Elements", "", subElement.Name ) ); } } foreach ( Generated.StructureElement otherElement in other.allElements() ) { bool found = false; foreach ( Generated.StructureElement subElement in obj.allElements() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Elements", otherElement.Name) ); } } } else { foreach ( Generated.StructureElement subElement in obj.allElements() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Elements", "", subElement.Name ) ); } } } else { if ( other.allElements() != null ) { foreach ( Generated.StructureElement otherElement in other.allElements() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Elements", otherElement.Name) ); } } } if ( obj.allProcedures() != null ) { if ( other.allProcedures() != null ) { foreach ( Generated.Procedure subElement in obj.allProcedures() ) { bool compared = false; foreach ( Generated.Procedure otherElement in other.allProcedures() ) { if ( subElement.Guid == otherElement.Guid ) { compareProcedure ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Procedures", "", subElement.Name ) ); } } foreach ( Generated.Procedure otherElement in other.allProcedures() ) { bool found = false; foreach ( Generated.Procedure subElement in obj.allProcedures() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Procedures", otherElement.Name) ); } } } else { foreach ( Generated.Procedure subElement in obj.allProcedures() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Procedures", "", subElement.Name ) ); } } } else { if ( other.allProcedures() != null ) { foreach ( Generated.Procedure otherElement in other.allProcedures() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Procedures", otherElement.Name) ); } } } if ( obj.allStateMachines() != null ) { if ( other.allStateMachines() != null ) { foreach ( Generated.StateMachine subElement in obj.allStateMachines() ) { bool compared = false; foreach ( Generated.StateMachine otherElement in other.allStateMachines() ) { if ( subElement.Guid == otherElement.Guid ) { compareStateMachine ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "StateMachines", "", subElement.Name ) ); } } foreach ( Generated.StateMachine otherElement in other.allStateMachines() ) { bool found = false; foreach ( Generated.StateMachine subElement in obj.allStateMachines() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "StateMachines", otherElement.Name) ); } } } else { foreach ( Generated.StateMachine subElement in obj.allStateMachines() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "StateMachines", "", subElement.Name ) ); } } } else { if ( other.allStateMachines() != null ) { foreach ( Generated.StateMachine otherElement in other.allStateMachines() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "StateMachines", otherElement.Name) ); } } } if ( obj.allRules() != null ) { if ( other.allRules() != null ) { foreach ( Generated.Rule subElement in obj.allRules() ) { bool compared = false; foreach ( Generated.Rule otherElement in other.allRules() ) { if ( subElement.Guid == otherElement.Guid ) { compareRule ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Rules", "", subElement.Name ) ); } } foreach ( Generated.Rule otherElement in other.allRules() ) { bool found = false; foreach ( Generated.Rule subElement in obj.allRules() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Rules", otherElement.Name) ); } } } else { foreach ( Generated.Rule subElement in obj.allRules() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Rules", "", subElement.Name ) ); } } } else { if ( other.allRules() != null ) { foreach ( Generated.Rule otherElement in other.allRules() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Rules", otherElement.Name) ); } } } if ( obj.allInterfaces() != null ) { if ( other.allInterfaces() != null ) { foreach ( Generated.StructureRef subElement in obj.allInterfaces() ) { bool compared = false; foreach ( Generated.StructureRef otherElement in other.allInterfaces() ) { if ( subElement.Guid == otherElement.Guid ) { compareStructureRef ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Interfaces", "", subElement.Name ) ); } } foreach ( Generated.StructureRef otherElement in other.allInterfaces() ) { bool found = false; foreach ( Generated.StructureRef subElement in obj.allInterfaces() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Interfaces", otherElement.Name) ); } } } else { foreach ( Generated.StructureRef subElement in obj.allInterfaces() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Interfaces", "", subElement.Name ) ); } } } else { if ( other.allInterfaces() != null ) { foreach ( Generated.StructureRef otherElement in other.allInterfaces() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Interfaces", otherElement.Name) ); } } } if ( obj.getIsAbstract() != other.getIsAbstract() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "IsAbstract", other.getIsAbstract().ToString(), obj.getIsAbstract().ToString()) ); } }
/// <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> /// 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()) ); } }