<commit_before>package com.esri.wdc.geodev201611;

import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.ArcGISScene;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.view.MapView;
import com.esri.arcgisruntime.mapping.view.SceneView;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class WorkshopApp extends Application {
    
    private ArcGISMap arcGisMap;
    private ArcGISScene arcGisScene;
    private boolean threeD = false;
    
    private MapView mapView;
    private SceneView sceneView;
    private final ImageView imageView_2d = new ImageView(new Image(getClass().getResourceAsStream("/resources/two-d.png")));
    private final ImageView imageView_3d = new ImageView(new Image(getClass().getResourceAsStream("/resources/three-d.png")));
    private final Button button_toggle2d3d = new Button(null, imageView_3d);
    private final AnchorPane anchorPane = new AnchorPane();
    
    @Override
    public void start(Stage primaryStage) {
        // Set up the 2D map, since we will display that first.
        arcGisMap = new ArcGISMap();
        arcGisMap.setBasemap(Basemap.createNationalGeographic());
        mapView = new MapView();
        mapView.setMap(arcGisMap);
        
        AnchorPane.setLeftAnchor(mapView, 0.0);
        AnchorPane.setRightAnchor(mapView, 0.0);
        AnchorPane.setTopAnchor(mapView, 0.0);
        AnchorPane.setBottomAnchor(mapView, 0.0);
        AnchorPane.setRightAnchor(button_toggle2d3d, 15.0);
        AnchorPane.setBottomAnchor(button_toggle2d3d, 15.0);
        anchorPane.getChildren().addAll(mapView, button_toggle2d3d);

        button_toggle2d3d.setOnAction((ActionEvent event) -> {
            button_toggle2d3d_onAction();
        });
        
        // JavaFX Scene (unrelated to ArcGIS 3D scene)
        Scene scene = new Scene(anchorPane);
        primaryStage.setTitle("My first map application");
        primaryStage.setWidth(800);
        primaryStage.setHeight(600);
        primaryStage.setScene(scene);
        primaryStage.show();        
    }
    
    private void button_toggle2d3d_onAction() {
        threeD = !threeD;
        button_toggle2d3d.setGraphic(threeD ? imageView_2d : imageView_3d);

        if (threeD) {
            if (null == sceneView) {
                // Set up the 3D scene. This only happens the first time the user switches to 3D.
                arcGisScene = new ArcGISScene();
                arcGisScene.setBasemap(Basemap.createNationalGeographic());
                arcGisScene.getOperationalLayers().addAll(arcGisMap.getOperationalLayers());
                sceneView = new SceneView();
                sceneView.setArcGISScene(arcGisScene);
                AnchorPane.setLeftAnchor(sceneView, 0.0);
                AnchorPane.setRightAnchor(sceneView, 0.0);
                AnchorPane.setTopAnchor(sceneView, 0.0);
                AnchorPane.setBottomAnchor(sceneView, 0.0);
            }
            anchorPane.getChildren().remove(mapView);
            anchorPane.getChildren().add(0, sceneView);
        } else {
            anchorPane.getChildren().remove(sceneView);
            anchorPane.getChildren().add(0, mapView);
        }
    }

    @Override
    public void stop() throws Exception {
        mapView.dispose();
        if (null != sceneView) {
            sceneView.dispose();
        }
        
        super.stop();
    }

    public static void main(String[] args) {
        launch(args);
    }
    
}<commit_msg>Added exercise-specific comments<commit_after>package com.esri.wdc.geodev201611;

import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.ArcGISScene;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.view.MapView;
import com.esri.arcgisruntime.mapping.view.SceneView;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;

public class WorkshopApp extends Application {
    
    // Exercise 1: Declare fields, including UI components
    private ArcGISMap arcGisMap;
    private ArcGISScene arcGisScene;
    private boolean threeD = false;
    private MapView mapView;
    private SceneView sceneView;
    private final ImageView imageView_2d = new ImageView(new Image(getClass().getResourceAsStream("/resources/two-d.png")));
    private final ImageView imageView_3d = new ImageView(new Image(getClass().getResourceAsStream("/resources/three-d.png")));
    private final Button button_toggle2d3d = new Button(null, imageView_3d);
    private final AnchorPane anchorPane = new AnchorPane();
    
    @Override
    public void start(Stage primaryStage) {
        // Exercise 1: Set up the 2D map, since we will display that first
        arcGisMap = new ArcGISMap();
        arcGisMap.setBasemap(Basemap.createNationalGeographic());
        mapView = new MapView();
        mapView.setMap(arcGisMap);
        
        // Exercise 1: Place the MapView and 2D/3D toggle button in the UI
        AnchorPane.setLeftAnchor(mapView, 0.0);
        AnchorPane.setRightAnchor(mapView, 0.0);
        AnchorPane.setTopAnchor(mapView, 0.0);
        AnchorPane.setBottomAnchor(mapView, 0.0);
        AnchorPane.setRightAnchor(button_toggle2d3d, 15.0);
        AnchorPane.setBottomAnchor(button_toggle2d3d, 15.0);
        anchorPane.getChildren().addAll(mapView, button_toggle2d3d);

        // Exercise 1: Set the 2D/3D toggle button's action
        button_toggle2d3d.setOnAction((ActionEvent event) -> {
            button_toggle2d3d_onAction();
        });
        
        // JavaFX Scene (unrelated to ArcGIS 3D scene)
        Scene scene = new Scene(anchorPane);
        primaryStage.setTitle("My first map application");
        primaryStage.setWidth(800);
        primaryStage.setHeight(600);
        primaryStage.setScene(scene);
        primaryStage.show();        
    }
    
    /**
     * Exercise 1: Toggle between 2D map and 3D scene
     */
    private void button_toggle2d3d_onAction() {
        threeD = !threeD;
        button_toggle2d3d.setGraphic(threeD ? imageView_2d : imageView_3d);

        if (threeD) {
            if (null == sceneView) {
                // Set up the 3D scene. This only happens the first time the user switches to 3D.
                arcGisScene = new ArcGISScene();
                arcGisScene.setBasemap(Basemap.createNationalGeographic());
                arcGisScene.getOperationalLayers().addAll(arcGisMap.getOperationalLayers());
                sceneView = new SceneView();
                sceneView.setArcGISScene(arcGisScene);
                AnchorPane.setLeftAnchor(sceneView, 0.0);
                AnchorPane.setRightAnchor(sceneView, 0.0);
                AnchorPane.setTopAnchor(sceneView, 0.0);
                AnchorPane.setBottomAnchor(sceneView, 0.0);
            }
            anchorPane.getChildren().remove(mapView);
            anchorPane.getChildren().add(0, sceneView);
        } else {
            anchorPane.getChildren().remove(sceneView);
            anchorPane.getChildren().add(0, mapView);
        }
    }

    @Override
    public void stop() throws Exception {
        // Exercise 1: dispose the MapView and SceneView before exiting
        mapView.dispose();
        if (null != sceneView) {
            sceneView.dispose();
        }
        
        super.stop();
    }

    public static void main(String[] args) {
        launch(args);
    }
    
}
{'fraction_non_alphanumeric': 0.09789674952198853, 'fraction_numerical': 0.01708094327597196, 'mean_word_length': 2.7079395085066165, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4560347', 'n_tokens_mistral': 2445, 'n_tokens_neox': 2291, 'n_words': 463}