class Brush implements Tool {

    //Architecture
    private ToolEventListener[] listeners;
    private BrushPanel brushPanel;
    //Settings
    private float[] color = {1f, 0f, 0f};
    private float intensity = 0.3f;
    private DiffusionMethods.DiffusionMethod diffusionMethod = DiffusionMethods.DiffusionMethod.NEIGHBORS;

    @Override
    public void select() {
    }

    @Override
    public void unselect() {
        listeners = null;
        brushPanel = null;
    }

    private void brush(Node[] nodes) {<FILL_FUNCTION_BODY>}

    private Node[] getDiffusedNodes(Node[] input) {
        GraphModel model = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
        switch (diffusionMethod) {
            case NEIGHBORS:
                return DiffusionMethods.getNeighbors(model.getGraphVisible(), input);
            case NEIGHBORS_OF_NEIGHBORS:
                return DiffusionMethods.getNeighborsOfNeighbors(model.getGraphVisible(), input);
            case PREDECESSORS:
                if (model.isDirected()) {
                    return DiffusionMethods.getPredecessors(model.getDirectedGraphVisible(), input);
                } else {
                    return DiffusionMethods.getNeighbors(model.getGraphVisible(), input);
                }
            case SUCCESSORS:
                if (model.isDirected()) {
                    return DiffusionMethods.getSuccessors(model.getDirectedGraphVisible(), input);
                } else {
                    return DiffusionMethods.getNeighbors(model.getGraphVisible(), input);
                }
        }
        return new Node[0];
    }

    @Override
    public ToolEventListener[] getListeners() {
        listeners = new ToolEventListener[1];
        listeners[0] = new NodePressingEventListener() {
            @Override
            public void pressingNodes(Node[] nodes) {
                diffusionMethod = brushPanel.getDiffusionMethod();
                color = brushPanel.getColor().getColorComponents(color);
                intensity = brushPanel.getIntensity();
                brush(nodes);
            }

            @Override
            public void released() {
            }
        };
        return listeners;
    }

    @Override
    public ToolUI getUI() {
        return new ToolUI() {
            @Override
            public JPanel getPropertiesBar(Tool tool) {
                brushPanel = new BrushPanel();
                brushPanel.setDiffusionMethod(diffusionMethod);
                brushPanel.setColor(new Color(color[0], color[1], color[2]));
                brushPanel.setIntensity(intensity);
                return brushPanel;
            }

            @Override
            public String getName() {
                return NbBundle.getMessage(Brush.class, "Brush.name");
            }

            @Override
            public Icon getIcon() {
                return ImageUtilities.loadImageIcon("ToolsPlugin/brush.png", false);
            }

            @Override
            public String getDescription() {
                return NbBundle.getMessage(Painter.class, "Brush.description");
            }

            @Override
            public int getPosition() {
                return 110;
            }
        };
    }

    @Override
    public ToolSelectionType getSelectionType() {
        return ToolSelectionType.SELECTION;
    }
}


        for (Node node : nodes) {
            float r = node.r();
            float g = node.g();
            float b = node.b();
            r = intensity * color[0] + (1 - intensity) * r;
            g = intensity * color[1] + (1 - intensity) * g;
            b = intensity * color[2] + (1 - intensity) * b;
            node.setR(r);
            node.setG(g);
            node.setB(b);
        }

        for (Node node : getDiffusedNodes(nodes)) {
            float r = node.r();
            float g = node.g();
            float b = node.b();
            r = intensity * color[0] + (1 - intensity) * r;
            g = intensity * color[1] + (1 - intensity) * g;
            b = intensity * color[2] + (1 - intensity) * b;
            node.setR(r);
            node.setG(g);
            node.setB(b);
        }
    
<no_super_class>