/// <summary> /// Cleans all text fields in this element /// </summary> /// <param name="obj"></param> /// <param name="visitSubNodes"></param> public override void visit(Generated.ParagraphRevision obj, bool visitSubNodes) { if ( obj.getText() != null ) { obj.setText(obj.getText().Trim()); } if ( obj.getVersion() != null ) { obj.setVersion(obj.getVersion().Trim()); } base.visit(obj, visitSubNodes); }
/// <summary> /// Cleans all text fields in this element /// </summary> /// <param name="obj"></param> /// <param name="visitSubNodes"></param> public override void visit(Generated.Specification obj, bool visitSubNodes) { if ( obj.getVersion() != null ) { obj.setVersion(obj.getVersion().Trim()); } base.visit(obj, visitSubNodes); }
/// <summary> /// Cleans all text fields in this element /// </summary> /// <param name="obj"></param> /// <param name="visitSubNodes"></param> public override void visit(Generated.Paragraph obj, bool visitSubNodes) { if ( obj.getId() != null ) { obj.setId(obj.getId().Trim()); } if ( obj.getBl() != null ) { obj.setBl(obj.getBl().Trim()); } if ( obj.getText() != null ) { obj.setText(obj.getText().Trim()); } if ( obj.getVersion() != null ) { obj.setVersion(obj.getVersion().Trim()); } if ( obj.getObsoleteFunctionalBlockName() != null ) { obj.setObsoleteFunctionalBlockName(obj.getObsoleteFunctionalBlockName().Trim()); } if ( obj.getObsoleteGuid() != null ) { obj.setObsoleteGuid(obj.getObsoleteGuid().Trim()); } base.visit(obj, visitSubNodes); }
/// <summary> /// Duplicates a source ParagraphRevision into its target /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void DuplicateParagraphRevision(Generated.ParagraphRevision source, Generated.ParagraphRevision target) { if ( source != null && target != null ) { target.setText(source.getText()); target.setVersion(source.getVersion()); } }
/// <summary> /// Duplicates a source Specification into its target /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void DuplicateSpecification(Generated.Specification source, Generated.Specification target) { if ( source != null && target != null ) { DuplicateNamable (source, target); target.setVersion(source.getVersion()); } }
/// <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> /// Duplicates a source Paragraph into its target /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void DuplicateParagraph(Generated.Paragraph source, Generated.Paragraph target) { if ( source != null && target != null ) { DuplicateReferencesParagraph (source, target); target.setId(source.getId()); target.setType(source.getType()); target.setBl(source.getBl()); target.setOptional(source.getOptional()); target.setText(source.getText()); target.setVersion(source.getVersion()); target.setReviewed(source.getReviewed()); target.setImplementationStatus(source.getImplementationStatus()); target.setMoreInfoRequired(source.getMoreInfoRequired()); target.setSpecIssue(source.getSpecIssue()); target.setTested(source.getTested()); } }
/// <summary> /// Compares two ParagraphRevision and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareParagraphRevision(Generated.ParagraphRevision obj, Generated.ParagraphRevision other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } if ( !CompareUtil.canonicalStringEquality(obj.getText(), other.getText()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Text", other.getText(), obj.getText()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getVersion(), other.getVersion()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Version", other.getVersion(), obj.getVersion()) ); } }
/// <summary> /// Compares two Paragraph and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareParagraph(Generated.Paragraph obj, Generated.Paragraph other, VersionDiff diff) { if ( other == null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "", "", obj.Name ) ); return; } compareReferencesParagraph (obj, other, diff); if ( !CompareUtil.canonicalStringEquality(obj.getId(), other.getId()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Id", other.getId(), obj.getId()) ); } if ( obj.getType() != other.getType() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Type", other.getType().ToString(), obj.getType().ToString()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getBl(), other.getBl()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Bl", other.getBl(), obj.getBl()) ); } if ( obj.getOptional() != other.getOptional() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Optional", other.getOptional().ToString(), obj.getOptional().ToString()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getText(), other.getText()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Text", other.getText(), obj.getText()) ); } if ( !CompareUtil.canonicalStringEquality(obj.getVersion(), other.getVersion()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Version", other.getVersion(), obj.getVersion()) ); } if ( obj.getReviewed() != other.getReviewed() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Reviewed", other.getReviewed().ToString(), obj.getReviewed().ToString()) ); } if ( obj.getImplementationStatus() != other.getImplementationStatus() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "ImplementationStatus", other.getImplementationStatus().ToString(), obj.getImplementationStatus().ToString()) ); } if ( obj.allParagraphs() != null ) { if ( other.allParagraphs() != null ) { foreach ( Generated.Paragraph subElement in obj.allParagraphs() ) { bool compared = false; foreach ( Generated.Paragraph otherElement in other.allParagraphs() ) { if ( subElement.Guid == otherElement.Guid ) { compareParagraph ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Paragraphs", "", subElement.Name ) ); } } foreach ( Generated.Paragraph otherElement in other.allParagraphs() ) { bool found = false; foreach ( Generated.Paragraph subElement in obj.allParagraphs() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Paragraphs", otherElement.Name) ); } } } else { foreach ( Generated.Paragraph subElement in obj.allParagraphs() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "Paragraphs", "", subElement.Name ) ); } } } else { if ( other.allParagraphs() != null ) { foreach ( Generated.Paragraph otherElement in other.allParagraphs() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "Paragraphs", otherElement.Name) ); } } } if ( obj.getRevision() == null ) { if ( other.getRevision() != null ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Revision", "" ) ); } } else { compareParagraphRevision ( obj.getRevision(), other.getRevision(), diff ); } if ( obj.getMoreInfoRequired() != other.getMoreInfoRequired() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "MoreInfoRequired", other.getMoreInfoRequired().ToString(), obj.getMoreInfoRequired().ToString()) ); } if ( obj.getSpecIssue() != other.getSpecIssue() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "SpecIssue", other.getSpecIssue().ToString(), obj.getSpecIssue().ToString()) ); } if ( obj.allRequirementSets() != null ) { if ( other.allRequirementSets() != null ) { foreach ( Generated.RequirementSetReference subElement in obj.allRequirementSets() ) { bool compared = false; foreach ( Generated.RequirementSetReference otherElement in other.allRequirementSets() ) { if ( subElement.Guid == otherElement.Guid ) { compareRequirementSetReference ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "RequirementSets", "", subElement.Name ) ); } } foreach ( Generated.RequirementSetReference otherElement in other.allRequirementSets() ) { bool found = false; foreach ( Generated.RequirementSetReference 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.RequirementSetReference subElement in obj.allRequirementSets() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "RequirementSets", "", subElement.Name ) ); } } } else { if ( other.allRequirementSets() != null ) { foreach ( Generated.RequirementSetReference otherElement in other.allRequirementSets() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "RequirementSets", otherElement.Name) ); } } } if ( obj.getTested() != other.getTested() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Tested", other.getTested().ToString(), obj.getTested().ToString()) ); } }
/// <summary> /// Searches a specific string in Specification and updates the list /// of model element with all the elements in which that string is found /// </summary> /// <param name="obj"></param> /// <param name="obj">The string to search for</param> /// <param name="occurences">The list of model elements which hold the searched string</param> public static void searchSpecification(Generated.Specification obj, string searchString, List<ModelElement> occurences) { searchNamable (obj, searchString, occurences); if ( obj.getVersion() != null && obj.getVersion().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.allChapters() != null ) { foreach ( Generated.Chapter subElement in obj.allChapters() ) { searchChapter ( subElement, searchString, occurences ); } } if ( obj.allChapterRefs() != null ) { foreach ( Generated.ChapterRef subElement in obj.allChapterRefs() ) { searchChapterRef ( subElement, searchString, occurences ); } } }
/// <summary> /// Searches a specific string in ParagraphRevision and updates the list /// of model element with all the elements in which that string is found /// </summary> /// <param name="obj"></param> /// <param name="obj">The string to search for</param> /// <param name="occurences">The list of model elements which hold the searched string</param> public static void searchParagraphRevision(Generated.ParagraphRevision obj, string searchString, List<ModelElement> occurences) { if ( obj.getText() != null && obj.getText().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.getVersion() != null && obj.getVersion().Contains (searchString) ) { occurences.Add ( obj ); } }
/// <summary> /// Searches a specific string in Paragraph and updates the list /// of model element with all the elements in which that string is found /// </summary> /// <param name="obj"></param> /// <param name="obj">The string to search for</param> /// <param name="occurences">The list of model elements which hold the searched string</param> public static void searchParagraph(Generated.Paragraph obj, string searchString, List<ModelElement> occurences) { searchReferencesParagraph (obj, searchString, occurences); if ( obj.getId() != null && obj.getId().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.getBl() != null && obj.getBl().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.getText() != null && obj.getText().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.getVersion() != null && obj.getVersion().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.allParagraphs() != null ) { foreach ( Generated.Paragraph subElement in obj.allParagraphs() ) { searchParagraph ( subElement, searchString, occurences ); } } if ( obj.getRevision() != null ) { searchParagraphRevision ( obj.getRevision(), searchString, occurences ); } if ( obj.getObsoleteFunctionalBlockName() != null && obj.getObsoleteFunctionalBlockName().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.allRequirementSets() != null ) { foreach ( Generated.RequirementSetReference subElement in obj.allRequirementSets() ) { searchRequirementSetReference ( subElement, searchString, occurences ); } } if ( obj.getObsoleteGuid() != null && obj.getObsoleteGuid().Contains (searchString) ) { occurences.Add ( obj ); } }