/// <summary> /// Transforms the results to the `details` format. /// </summary> public void ToDetailed() { if (!Annotations.Any() && Message == null && NestedResults.Count == 0) { return; } if (NestedResults.Count == 1) { NestedResults[0].ToDetailed(); CopyFrom(NestedResults[0]); return; } var condensed = new List <ValidationResults>(); foreach (var result in NestedResults) { result.ToDetailed(); if (result.Keep && result.IsValid == IsValid) { condensed.Add(result); } } _nestedResults.Clear(); if (condensed.Count == 1) { CopyFrom(condensed[0]); } else { _nestedResults.AddRange(condensed); } }
private IEnumerable <ValidationResults> _GetAllChildren() { var all = new List <ValidationResults>(); if (Annotations.Any() || Message != null) { all.Add(this); } all.AddRange(NestedResults.SelectMany(r => r._GetAllChildren())); _nestedResults.Clear(); return(all); }
public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); if (IsAutowired) { stringBuilder.AppendLine(); stringBuilder.AppendLine(Indent + "@Autowired"); } if (Annotations.Any()) { foreach (var annotation in Annotations) { stringBuilder.AppendLine(); stringBuilder.AppendLine(annotation); } } stringBuilder.AppendLine(Indent + base.ToString() + DefaultValueFormated + Ending); return(stringBuilder.ToString()); }
///<inheritdoc/> public override void Redraw(Rect bounds) { if (CellSize.X == 0 || CellSize.Y == 0) { throw new Exception($"{nameof(CellSize)} cannot be 0"); } SetDriverColorToGraphColor(); Move(0, 0); // clear all old content for (int i = 0; i < Bounds.Height; i++) { Move(0, i); Driver.AddStr(new string (' ', Bounds.Width)); } // If there is no data do not display a graph if (!Series.Any() && !Annotations.Any()) { return; } // Draw 'before' annotations foreach (var a in Annotations.Where(a => a.BeforeSeries)) { a.Render(this); } SetDriverColorToGraphColor(); AxisY.DrawAxisLine(this); AxisX.DrawAxisLine(this); AxisY.DrawAxisLabels(this); AxisX.DrawAxisLabels(this); // Draw a cross where the two axis cross var axisIntersection = new Point(AxisY.GetAxisXPosition(this), AxisX.GetAxisYPosition(this)); if (AxisX.Visible && AxisY.Visible) { Move(axisIntersection.X, axisIntersection.Y); AddRune(axisIntersection.X, axisIntersection.Y, '\u253C'); } SetDriverColorToGraphColor(); // The drawable area of the graph (anything that isn't in the margins) Rect drawBounds = new Rect((int)MarginLeft, 0, Bounds.Width - ((int)MarginLeft), Bounds.Height - (int)MarginBottom); RectangleF graphSpace = ScreenToGraphSpace(drawBounds); foreach (var s in Series) { s.DrawSeries(this, drawBounds, graphSpace); // If a series changes the graph color reset it SetDriverColorToGraphColor(); } SetDriverColorToGraphColor(); // Draw 'after' annotations foreach (var a in Annotations.Where(a => !a.BeforeSeries)) { a.Render(this); } }
public bool IsInspectionDisabled(string inspectionName) { return(Annotations.Any(annotation => annotation.AnnotationType == AnnotationType.Ignore && ((IgnoreAnnotation)annotation).IsIgnored(inspectionName))); }
public bool IsAnnotatedBy(int annotatorId) { return(Annotations.Any(a => a.Annotator.Id == annotatorId)); }
// Nested indent have to be set for each Nested element and subelement separately, or after generation manualy to select nested code and indent it with tab // Setting it automaticaly and propagating could be done if the parent sets the child's parent reference (to itself) when the child is added/assigned to a parent. Parent setter is internal. // http://softwareengineering.stackexchange.com/questions/261453/what-is-the-best-way-to-initialize-a-childs-reference-to-its-parent public override string ToString() { if (AutoGenerateProperties) { Properties.Clear(); foreach (var field in Fields) { Properties.Add(new Property(field.BuiltInDataType, field.Name) { IsGetOnly = IsGetOnly }); } } string result = string.Empty; result += $"{Package}"; result += Util.NewLine; result += Util.NewLine; if (Imports.Any()) { foreach (var import in Imports) { result += $"{import}"; result += Util.NewLine; } } result += Util.NewLine; if (Annotations.Any()) { foreach (var annotation in Annotations) { result += annotation; result += Util.NewLine; } } result += base.ToString(); result += (BaseClass != null || Interfaces?.Count > 0) ? $" : " : ""; result += BaseClass ?? ""; result += (BaseClass != null && Interfaces?.Count > 0) ? $", " : ""; result += Interfaces?.Count > 0 ? string.Join(", ", Interfaces) : ""; result += " {"; result += Util.NewLine; result += string.Join("", Fields); var visibleConstructors = Constructors.Where(a => a.IsVisible); bool hasFieldsBeforeConstructor = visibleConstructors.Any() && Fields.Any(); result += string.Join("," + Util.NewLine, EnumList); result += hasFieldsBeforeConstructor ? Util.NewLine : ""; result += string.Join(Util.NewLine, visibleConstructors); bool hasMembersAfterConstructor = (visibleConstructors.Any() || Fields.Any()) && (Properties.Any() || Methods.Any()); result += hasMembersAfterConstructor ? Util.NewLine : ""; result += string.Join(HasPropertiesSpacing ? Util.NewLine : "", Properties); bool hasPropertiesAndMethods = Properties.Count > 0 && Methods.Count > 0; result += hasMembersAfterConstructor ? Util.NewLine : ""; result += string.Join(Util.NewLine, Methods); result += NestedClasses.Count > 0 ? Util.NewLine : ""; result += string.Join(Util.NewLine, NestedClasses); result += Util.NewLine + "}"; return(result); }