Beispiel #1
0
        public Expr(string name, ExprType type)
        {
            Name = name;
            Type = type;

            _graph = new Graph();
            _graph.AddVertex(this);
        }
Beispiel #2
0
        private Graph ConcatGraphs(params Graph[] graphs)
        {
            var result = new Graph();

            for (int i = 0; i < graphs.Length; i++)
            {
                result.AddVertexRange(graphs[i].Vertices);
                result.AddEdgeRange(graphs[i].Edges);
            }
            result.AddVertex(this);

            foreach (var sink in graphs.SelectMany(x => x.Sinks()))
            {
                result.AddEdge(new Edge <Expr>(sink, this));
            }

            return(result);
        }
Beispiel #3
0
 private Expr(string name, Expr operand, ExprType type)
 {
     Name   = name;
     Type   = type;
     _graph = ConcatGraphs(operand._graph);
 }
Beispiel #4
0
 private Expr(Expr left, Expr right, ExprType type)
 {
     Type   = type;
     _graph = ConcatGraphs(left._graph, right._graph);
 }