<commit_before>/**
 * Created by Thagus on 18/10/16.
 */
public class Main {
}<commit_msg>Basic grid with moving users<commit_after>import com.badlogic.ashley.core.Engine;
import com.badlogic.ashley.core.Entity;
import com.badlogic.ashley.core.EntitySystem;
import components.CityBlockComponent;
import components.UserComponent;
import javafx.animation.AnimationTimer;
import javafx.application.Application;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
import systems.UserMovementSystem;

import java.util.ArrayList;

/**
 * Created by Thagus on 18/10/16.
 */
public class Main extends Application{
    private Engine engine;
    private ArrayList<EntitySystem> systemArrayList;

    public void start(Stage primaryStage) throws Exception {
        primaryStage.setTitle("Cellular simulator");


        BorderPane pane = new BorderPane();

        initialize();
        pane.getChildren().addAll(createCityBlocks());
        pane.getChildren().addAll(createUsers());
        addSystems();


        final Scene scene = new Scene(pane, 802, 604, Color.BLACK);
        primaryStage.setScene(scene);
        primaryStage.show();

        startTick();
    }

    private void initialize(){
        engine = new Engine();


    }

    private void addSystems(){
        systemArrayList = new ArrayList<>();

        systemArrayList.add(new UserMovementSystem(800, 600));

        for(EntitySystem es : systemArrayList){
            engine.addSystem(es);
        }
    }

    private ArrayList<Node> createCityBlocks(){
        int width = 73;
        int height = 55;

        ArrayList<Node> nodes = new ArrayList<>();

        for(int i=0; i<width; i++){
            for(int j=0; j<height; j++){
                Rectangle rectangle = new Rectangle(i*10+i, j*10+j, 10, 10);
                CityBlockComponent cityBlockComponent = new CityBlockComponent(rectangle, CityBlockComponent.BlockType.TRAFFIC);
                Entity cityBlock = new Entity();
                cityBlock.add(cityBlockComponent);

                engine.addEntity(cityBlock);
                nodes.add(rectangle);
            }
        }

        return nodes;
    }

    private void createCells(){

    }

    private ArrayList<Node> createUsers(){
        int numUsers = 10;
        ArrayList<Node> nodes = new ArrayList<>();


        for(int i=0; i<numUsers; i++){
            Circle circle = new Circle(5);
            UserComponent userComponent = new UserComponent(circle);

            Entity user = new Entity();
            user.add(userComponent);

            engine.addEntity(user);

            nodes.add(circle);
        }

        return nodes;
    }

    private void startTick(){
        //Update canvas
        new AnimationTimer() {
            private long lastTime = System.currentTimeMillis();

            @Override
            public void handle(long now) {
                long currentTime = System.currentTimeMillis();
                float delta = (currentTime-lastTime)/1000f;
                lastTime = currentTime;
                //System.out.println(delta);

                for(EntitySystem es : systemArrayList){
                    es.update(delta);
                }

            }
        }.start();
    }
}
{'fraction_non_alphanumeric': 0.10577489687684148, 'fraction_numerical': 0.013553329404832056, 'mean_word_length': 2.2738669238187077, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 11, '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': '6476471', 'n_tokens_mistral': 965, 'n_tokens_neox': 874, 'n_words': 213}