/// <summary> /// Cleans all text fields in this element /// </summary> /// <param name="obj"></param> /// <param name="visitSubNodes"></param> public override void visit(Generated.Frame obj, bool visitSubNodes) { if ( obj.getCycleDuration() != null ) { obj.setCycleDuration(obj.getCycleDuration().Trim()); } if ( obj.getComment() != null ) { obj.setComment(obj.getComment().Trim()); } base.visit(obj, visitSubNodes); }
/// <summary> /// Searches a specific string in Frame 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 searchFrame(Generated.Frame obj, string searchString, List<ModelElement> occurences) { searchNamable (obj, searchString, occurences); if ( obj.getCycleDuration() != null && obj.getCycleDuration().Contains (searchString) ) { occurences.Add ( obj ); } if ( obj.allSubSequences() != null ) { foreach ( Generated.SubSequence subElement in obj.allSubSequences() ) { searchSubSequence ( subElement, searchString, occurences ); } } if ( obj.getComment() != null && obj.getComment().Contains (searchString) ) { occurences.Add ( obj ); } }
/// <summary> /// Duplicates a source Frame into its target /// </summary> /// <param name="source"></param> /// <param name="target"></param> public static void DuplicateFrame(Generated.Frame source, Generated.Frame target) { if ( source != null && target != null ) { DuplicateNamable (source, target); target.setCycleDuration(source.getCycleDuration()); target.setComment(source.getComment()); } }
/// <summary> /// Compares two Frame and annotates the differences on the first one /// </summary> /// <param name="obj"></param> /// <param name="other"></param> public static void compareFrame(Generated.Frame obj, Generated.Frame 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.getCycleDuration(), other.getCycleDuration()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "CycleDuration", other.getCycleDuration(), obj.getCycleDuration()) ); } if ( obj.allSubSequences() != null ) { if ( other.allSubSequences() != null ) { foreach ( Generated.SubSequence subElement in obj.allSubSequences() ) { bool compared = false; foreach ( Generated.SubSequence otherElement in other.allSubSequences() ) { if ( subElement.Guid == otherElement.Guid ) { compareSubSequence ( subElement, otherElement, diff ); compared = true; break; } } if ( !compared ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubSequences", "", subElement.Name ) ); } } foreach ( Generated.SubSequence otherElement in other.allSubSequences() ) { bool found = false; foreach ( Generated.SubSequence subElement in obj.allSubSequences() ) { if ( subElement.Guid == otherElement.Guid ) { found = true; break; } } if ( !found ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubSequences", otherElement.Name) ); } } } else { foreach ( Generated.SubSequence subElement in obj.allSubSequences() ) { diff.appendChanges ( new Diff(subElement, HistoricalData.Generated.acceptor.ChangeOperationEnum.aAdd, "SubSequences", "", subElement.Name ) ); } } } else { if ( other.allSubSequences() != null ) { foreach ( Generated.SubSequence otherElement in other.allSubSequences() ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aRemove , "SubSequences", otherElement.Name) ); } } } if ( !CompareUtil.canonicalStringEquality(obj.getComment(), other.getComment()) ) { diff.appendChanges ( new Diff(obj, HistoricalData.Generated.acceptor.ChangeOperationEnum.aChange, "Comment", other.getComment(), obj.getComment()) ); } }