public FormulaFunction(CellVertex formulaVertex, Expression expression) : base(formulaVertex) { Name.IsFunction = true; Expression = expression; Parameters = expression.GetLeafsOfType <InputReference>().ToArray(); ReturnType = expression.GetCellType(); }
private const int VERTEX_BOX = 60; // width and height of a vertex including spacing public static DColor GetClassificationColor(this CellVertex cellVertex) { if (cellVertex.IsExternal) { return(_externalNodeColor); } switch (cellVertex.Classification) { case Classification.InputField: return(_inputNodeColor); case Classification.Constant: return(_constantNodeColor); case Classification.OutputField: return(_outputNodeColor); case Classification.Formula: return(_formulaNodeColor); default: return(DColor.Transparent); } }
public static NodeViewModel FormatCellVertex(this CellVertex cellVertex, double posX, double posY) { var size = cellVertex.Classification == Classification.OutputField ? 40 : Math.Min(55, cellVertex.Parents.Count * 4 + 25); var node = new NodeViewModel { ID = _nodeCounter++, Content = cellVertex, ContentTemplate = new DataTemplate(), UnitWidth = size, UnitHeight = size, OffsetX = posX, OffsetY = posY, ZIndex = 10000, Annotations = new AnnotationCollection { new AnnotationEditorViewModel { Offset = new Point(0, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom, Content = cellVertex.Name == null ? cellVertex.StringAddress : (string)cellVertex.Name, ViewTemplate = cellVertex.Name == null ? _redLabelTemplate : _normalLabelTemplate, UnitWidth = 200 } } }; switch (cellVertex.Classification) { case Classification.InputField: node.Shape = _inputShape; node.ShapeStyle = _inputShapeStyle; break; case Classification.Constant: node.Shape = _constantShape; node.ShapeStyle = _constantShapeStyle; break; case Classification.Formula: node.Shape = _formulaShape; node.ShapeStyle = _formulaShapeStyle; break; case Classification.OutputField: node.Shape = _outputShape; node.ShapeStyle = _outputShapeStyle; break; } SetNodeConstraints(node); cellVertex.Node = node; return(node); }
public Cell(Cell parent, CellVertex index, Vertex[] vertices) { this.index = index; this.parent = parent; level = parent.level + 1; tree = parent.tree; uid = tree.getCellUID; //vertices = new Vertex[CellVerticesNumber]; children = null; data = new TCellData(); tree.cells.Add(this); this.vertices = vertices; }
public void SetExpectedValue(CellVertex vertex) { if (vertex == null) { ExpectedValue = null; ExpectedValueType = CellType.Unknown; } else { ExpectedValue = vertex.Value; ExpectedValueType = vertex.CellType; } }
public OutputFieldFunction(CellVertex outputFieldVertex, Statement[] statements) : base(outputFieldVertex) { Name.IsOutputField = true; Statements = statements; var statementVariableNames = Statements.Select(statement => statement.VariableName.ToString()).ToHashSet(); Parameters = Statements .OfType <FunctionInvocationStatement>() .SelectMany(statement => statement.Parameters) .Where(inputReference => !statementVariableNames.Contains(inputReference.VariableName.ToString())) .ToArray(); ReturnType = statements.Last().VariableType; }
protected CellFunction(CellVertex vertex) { Name = vertex.Name.Copy(); }
public InputReference(CellVertex cellVertex) : base(cellVertex.Name) { InputType = cellVertex.CellType; }
public GlobalCellReference(CellVertex cellVertex) : base(cellVertex) { ReferencedVertex = cellVertex; }
public static NodeViewModel FormatCellVertex(this CellVertex cellVertex, Graph graph) { return(FormatCellVertex(cellVertex, Array.IndexOf(graph.PopulatedColumns, cellVertex.Address.col) * VERTEX_BOX + DIAGRAM_PADDING, Array.IndexOf(graph.PopulatedRows, cellVertex.Address.row) * VERTEX_BOX + DIAGRAM_PADDING)); }
public void StyleBorderByClassification(CellVertex cellVertex, IBorders borderStyle) { borderStyle.ColorRGB = cellVertex.GetClassificationColor(); borderStyle.LineStyle = cellVertex.Classification == Classification.None ? ExcelLineStyle.None : ExcelLineStyle.Thick; }