//------------------------------------------------------------------ // INamedSequence public abstract string GetDecoratedName(string coreName, PrettyPrintContext context, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee);
//-------------------------------------------------------------------------- // INamedSequence public override string GetDecoratedName(string coreName, PrettyPrintContext ppContext, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee) { return this.GetDecoratedNameDoubleHelper(coreName, ppContext, root, caller, out callee, "{0}'", NAMED_SEQUENCE_DECORATOR.COMPLEMENT); }
//-------------------------------------------------------------------------- // INamedSequence public override string GetDecoratedName(string coreName, PrettyPrintContext context, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee) { return this.GetDecoratedNameDoubleHelper(coreName, context, root, caller, out callee, "reversed({0})", NAMED_SEQUENCE_DECORATOR.REVERSE); }
protected string GetDecoratedNameDoubleHelper(string coreName, PrettyPrintContext context, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee, string format, NAMED_SEQUENCE_DECORATOR usFlavor ) // Shared code for reversing and complementing { callee = usFlavor; // if (this == root) return context.FormatDisplayName(coreName, this.Id); // if (this.target is INamedSequence) { INamedSequence decorator = this.target as INamedSequence; NAMED_SEQUENCE_DECORATOR decoratorFlavor; if (caller == usFlavor) { // us and caller are of same flavor: just forward on to the target so that the two cancel return decorator.GetDecoratedName(coreName, context, root, NAMED_SEQUENCE_DECORATOR.NONE, out decoratorFlavor); } else { // get from target string his = (this.target as INamedSequence).GetDecoratedName(coreName, context, root, usFlavor, out decoratorFlavor); // if (decoratorFlavor==usFlavor) return his; else return string.Format(format, his); } } return string.Format(format, context.FormatDisplayName(coreName, this.Id)); }
//-------------------------------------------------------------------------- // INamedSequence public override string GetDecoratedName(string coreName, PrettyPrintContext context, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee) // Default implementation that just stops at us if we're the root and forwards on to target if not { callee = NAMED_SEQUENCE_DECORATOR.NONE; // if (this == root) return context.FormatDisplayName(coreName, this.Id); // if (this.target is INamedSequence) { INamedSequence decorator = this.target as INamedSequence; NAMED_SEQUENCE_DECORATOR decoratorFlavor; return decorator.GetDecoratedName(coreName, context, root, NAMED_SEQUENCE_DECORATOR.NONE, out decoratorFlavor); } // return context.FormatDisplayName(coreName, this.Id); }
//-------------------------------------------------------------------------- // INamedSequence public override string GetDecoratedName(string coreName, PrettyPrintContext context, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee) { callee = NAMED_SEQUENCE_DECORATOR.NONE; return context.FormatDisplayName(coreName, this.Id); }