<commit_before>package nars.grid2d.gui;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import nars.grid2d.Grid2DSpace;

/**
 *
 * @author me
 */


public class EditorPanel extends JPanel {

    abstract public static class EditorMode extends DefaultMutableTreeNode {

        public EditorMode(String label) {
            super(label);
        }
        
        abstract public void run();
    }
    
    public EditorPanel(final Grid2DSpace s) {
        super(new BorderLayout());
        
        
        DefaultMutableTreeNode root = new DefaultMutableTreeNode();
        
        DefaultMutableTreeNode structMenu = new DefaultMutableTreeNode("Structural");
        root.add(structMenu);
        
        DefaultMutableTreeNode logicMenu = new DefaultMutableTreeNode("Logic");
        root.add(logicMenu);

        DefaultMutableTreeNode machineMenu = new DefaultMutableTreeNode("Machine");
        root.add(machineMenu);
        
        root.add(new DefaultMutableTreeNode("Tools"));
        
        
        DefaultTreeModel model = new DefaultTreeModel(root);
        
        final JTree toolTree = new JTree(model);       
        toolTree.expandRow(0);
        add(toolTree, BorderLayout.CENTER);
        
        toolTree.addTreeSelectionListener(new TreeSelectionListener() {
            @Override public void valueChanged(TreeSelectionEvent e) {
                Object o = toolTree.getLastSelectedPathComponent();
                if (o instanceof EditorMode) {
                    EditorMode m = (EditorMode)o;
                    m.run();
                }
            }            
        });
        
        structMenu.add(new EditorMode("Stone Wall") {
            @Override public void run() { s.cells.click("StoneWall"); }            
        });
        structMenu.add(new EditorMode("Dirt Floor") {
            @Override public void run() { s.cells.click("DirtFloor"); }            
        });
        
        
        logicMenu.add(new EditorMode("On Wire") {
            @Override public void run() { s.cells.click("OnWire"); }            
        });
        logicMenu.add(new EditorMode("Off Wire") {
            @Override public void run() { s.cells.click("OffWire"); }            
        });
        logicMenu.add(new EditorMode("And") {
            @Override public void run() { s.cells.click("AND"); }
        });
        logicMenu.add(new EditorMode("Or") {
            @Override public void run() { s.cells.click("OR"); }
        });
        logicMenu.add(new EditorMode("Xor") {
            @Override public void run() { s.cells.click("XOR"); }
        });
        logicMenu.add(new EditorMode("Not") {
            @Override public void run() { s.cells.click("NOT"); }
        });        
        logicMenu.add(new EditorMode("Bridge") {
            @Override public void run() { s.cells.click("bridge"); }
        });
        logicMenu.add(new EditorMode("Off Switch") {
            @Override public void run() { s.cells.click("offswitch"); }
        });
        logicMenu.add(new EditorMode("On Switch") {
            @Override public void run() { s.cells.click("onswitch"); }
        });        
        
        machineMenu.add(new EditorMode("Light") {
            @Override public void run() { s.cells.click("Light"); }
        });        
        machineMenu.add(new EditorMode("Turret") {
            @Override public void run() { s.cells.click("Turret"); }
        });        
        
    }
    
    
}<commit_msg>Doors added, rendering adjusted.<commit_after>package nars.grid2d.gui;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import nars.grid2d.Grid2DSpace;

/**
 *
 * @author me
 */


public class EditorPanel extends JPanel {

    abstract public static class EditorMode extends DefaultMutableTreeNode {

        public EditorMode(String label) {
            super(label);
        }
        
        abstract public void run();
    }
    
    public EditorPanel(final Grid2DSpace s) {
        super(new BorderLayout());
        
        
        DefaultMutableTreeNode root = new DefaultMutableTreeNode();
        
        DefaultMutableTreeNode structMenu = new DefaultMutableTreeNode("Structural");
        root.add(structMenu);
        
        DefaultMutableTreeNode logicMenu = new DefaultMutableTreeNode("Logic");
        root.add(logicMenu);

        DefaultMutableTreeNode machineMenu = new DefaultMutableTreeNode("Machine");
        root.add(machineMenu);
        
        root.add(new DefaultMutableTreeNode("Tools"));
        
        
        DefaultTreeModel model = new DefaultTreeModel(root);
        
        final JTree toolTree = new JTree(model);       
        toolTree.expandRow(0);
        add(toolTree, BorderLayout.CENTER);
        
        toolTree.addTreeSelectionListener(new TreeSelectionListener() {
            @Override public void valueChanged(TreeSelectionEvent e) {
                Object o = toolTree.getLastSelectedPathComponent();
                if (o instanceof EditorMode) {
                    EditorMode m = (EditorMode)o;
                    m.run();
                }
            }            
        });
        
        structMenu.add(new EditorMode("Stone Wall") {
            @Override public void run() { s.cells.click("StoneWall"); }            
        });
        structMenu.add(new EditorMode("Dirt Floor") {
            @Override public void run() { s.cells.click("DirtFloor"); }            
        });
        
        
        logicMenu.add(new EditorMode("On Wire") {
            @Override public void run() { s.cells.click("OnWire"); }            
        });
        logicMenu.add(new EditorMode("Off Wire") {
            @Override public void run() { s.cells.click("OffWire"); }            
        });
        logicMenu.add(new EditorMode("And") {
            @Override public void run() { s.cells.click("AND"); }
        });
        logicMenu.add(new EditorMode("Or") {
            @Override public void run() { s.cells.click("OR"); }
        });
        logicMenu.add(new EditorMode("Xor") {
            @Override public void run() { s.cells.click("XOR"); }
        });
        logicMenu.add(new EditorMode("Not") {
            @Override public void run() { s.cells.click("NOT"); }
        });        
        logicMenu.add(new EditorMode("Bridge") {
            @Override public void run() { s.cells.click("bridge"); }
        });
        logicMenu.add(new EditorMode("Off Switch") {
            @Override public void run() { s.cells.click("offswitch"); }
        });
        logicMenu.add(new EditorMode("On Switch") {
            @Override public void run() { s.cells.click("onswitch"); }
        });        
        
        machineMenu.add(new EditorMode("Light") {
            @Override public void run() { s.cells.click("Light"); }
        });        
        machineMenu.add(new EditorMode("Turret") {
            @Override public void run() { s.cells.click("Turret"); }
        });    
        
        machineMenu.add(new EditorMode("Door") {
            @Override public void run() { s.cells.click("Door"); }
        });  
        
    }
    
    
}
{'fraction_non_alphanumeric': 0.11994784876140809, 'fraction_numerical': 0.001303780964797914, 'mean_word_length': 1.9801864801864801, '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': '5757427', 'n_tokens_mistral': 2099, 'n_tokens_neox': 2014, 'n_words': 406}