<commit_before>package vtk;

import java.awt.Canvas;
import java.awt.Graphics;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.Observable;
import java.util.Observer;

import javax.swing.SwingUtilities;

/**
 * Java AWT component that encapsulate vtkRenderWindow, vtkRenderer, vtkCamera,
 * vtkLight.
 *
 * If a vtkInteractor is needed, use vtkCanvas instead. This is necessary when
 * Widget and Picker are used.
 *
 * @author Kitware
 */
public class vtkPanel extends Canvas implements MouseListener, MouseMotionListener, KeyListener {
    private static final long serialVersionUID = 1L;
    protected vtkRenderWindow rw = new vtkRenderWindow();
    protected vtkRenderer ren = new vtkRenderer();
    protected vtkCamera cam = null;
    protected vtkLight lgt = new vtkLight();
    protected int lastX;
    protected int lastY;
    protected int windowset = 0;
    protected int lightingset = 0;
    protected int LightFollowCamera = 1;
    protected int InteractionMode = 1;
    protected boolean rendering = false;
    protected WindowObservable windowSetObservable = new WindowObservable();

    static {
        vtkNativeLibrary.COMMON.LoadLibrary();
        vtkNativeLibrary.FILTERING.LoadLibrary();
        vtkNativeLibrary.IO.LoadLibrary();
        vtkNativeLibrary.IMAGING.LoadLibrary();
        vtkNativeLibrary.GRAPHICS.LoadLibrary();
        vtkNativeLibrary.RENDERING.LoadLibrary();
        try {
            vtkNativeLibrary.HYBRID.LoadLibrary();
        } catch (UnsatisfiedLinkError e) {
            System.out.println("cannot load vtkHybrid, skipping...");
        }
        try {
            vtkNativeLibrary.VOLUME_RENDERING.LoadLibrary();
        } catch (Throwable e) {
            System.out.println("cannot load vtkVolumeRendering, skipping...");
        }
    }

    // Allow access to display lock() and unlock().
    // Call these whenever you call something that causes
    // a Render().
    // e.g.
    // panel.lock();
    // // Code that causes a render
    // panel.unlock();
    public void lock() {
        Lock();
    }

    public void unlock() {
        UnLock();
    }

    public void Delete() {
        if (this.getParent() != null) {
            this.getParent().remove(this);
            this.getParent().validate();
        }
        // Free internal VTK objects
        rw.Delete();
        ren.Delete();
        cam.Delete();
        lgt.Delete();
    }

    protected native int RenderCreate(vtkRenderWindow id0);<commit_msg>Fix Delete() in vtkPanel<commit_after>package vtk;

import java.awt.Canvas;
import java.awt.Graphics;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.Observable;
import java.util.Observer;

import javax.swing.SwingUtilities;

/**
 * Java AWT component that encapsulate vtkRenderWindow, vtkRenderer, vtkCamera,
 * vtkLight.
 *
 * If a vtkInteractor is needed, use vtkCanvas instead. This is necessary when
 * Widget and Picker are used.
 *
 * @author Kitware
 */
public class vtkPanel extends Canvas implements MouseListener, MouseMotionListener, KeyListener {
    private static final long serialVersionUID = 1L;
    protected vtkRenderWindow rw = new vtkRenderWindow();
    protected vtkRenderer ren = new vtkRenderer();
    protected vtkCamera cam = null;
    protected vtkLight lgt = new vtkLight();
    protected int lastX;
    protected int lastY;
    protected int windowset = 0;
    protected int lightingset = 0;
    protected int LightFollowCamera = 1;
    protected int InteractionMode = 1;
    protected boolean rendering = false;
    protected WindowObservable windowSetObservable = new WindowObservable();

    static {
        vtkNativeLibrary.COMMON.LoadLibrary();
        vtkNativeLibrary.FILTERING.LoadLibrary();
        vtkNativeLibrary.IO.LoadLibrary();
        vtkNativeLibrary.IMAGING.LoadLibrary();
        vtkNativeLibrary.GRAPHICS.LoadLibrary();
        vtkNativeLibrary.RENDERING.LoadLibrary();
        try {
            vtkNativeLibrary.HYBRID.LoadLibrary();
        } catch (UnsatisfiedLinkError e) {
            System.out.println("cannot load vtkHybrid, skipping...");
        }
        try {
            vtkNativeLibrary.VOLUME_RENDERING.LoadLibrary();
        } catch (Throwable e) {
            System.out.println("cannot load vtkVolumeRendering, skipping...");
        }
    }

    // Allow access to display lock() and unlock().
    // Call these whenever you call something that causes
    // a Render().
    // e.g.
    // panel.lock();
    // // Code that causes a render
    // panel.unlock();
    public void lock() {
        Lock();
    }

    public void unlock() {
        UnLock();
    }

    public void Delete() {
        if (this.getParent() != null) {
            this.getParent().remove(this);
        }
        // Free internal VTK objects
        rw.Delete();
        ren.Delete();
        cam.Delete();
        lgt.Delete();
    }

    protected native int RenderCreate(vtkRenderWindow id0);
{'fraction_non_alphanumeric': 0.10128739113971981, 'fraction_numerical': 0.002271866717152594, 'mean_word_length': 2.7601423487544485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5876270', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1475, 'n_words': 393}