Search in sources :

Example 1 with DataFlowVisitor

use of org.eclipse.n4js.flowgraphs.dataflow.DataFlowVisitor in project n4js by eclipse.

the class GraphVisitorAnalysis method getGraphVisitors.

private List<GraphVisitorInternal> getGraphVisitors(FlowAnalyser[] flowAnalysers, TraverseDirection direction) {
    List<GraphVisitorInternal> graphVisitors = new LinkedList<>();
    List<DataFlowVisitor> dataflowVisitorList = new LinkedList<>();
    for (FlowAnalyser flowAnalyser : flowAnalysers) {
        if (flowAnalyser instanceof GraphVisitorInternal) {
            GraphVisitorInternal graphVisitor = (GraphVisitorInternal) flowAnalyser;
            if (graphVisitor.getDirection() == direction) {
                graphVisitors.add(graphVisitor);
            }
        }
        if (flowAnalyser instanceof DataFlowVisitor) {
            DataFlowVisitor dataflowVisitor = (DataFlowVisitor) flowAnalyser;
            if (dataflowVisitor.getDirection() == direction) {
                dataflowVisitorList.add(dataflowVisitor);
            }
        }
    }
    if (!dataflowVisitorList.isEmpty()) {
        DataFlowVisitorHost dfvh = new DataFlowVisitorHost(direction, dataflowVisitorList);
        graphVisitors.add(dfvh);
    }
    return graphVisitors;
}
Also used : DataFlowVisitor(org.eclipse.n4js.flowgraphs.dataflow.DataFlowVisitor) DataFlowVisitorHost(org.eclipse.n4js.flowgraphs.dataflow.DataFlowVisitorHost) FlowAnalyser(org.eclipse.n4js.flowgraphs.FlowAnalyser) N4JSFlowAnalyser(org.eclipse.n4js.flowgraphs.N4JSFlowAnalyser) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)1 FlowAnalyser (org.eclipse.n4js.flowgraphs.FlowAnalyser)1 N4JSFlowAnalyser (org.eclipse.n4js.flowgraphs.N4JSFlowAnalyser)1 DataFlowVisitor (org.eclipse.n4js.flowgraphs.dataflow.DataFlowVisitor)1 DataFlowVisitorHost (org.eclipse.n4js.flowgraphs.dataflow.DataFlowVisitorHost)1