Package eas.users.demos.oclrBlinken

Source Code of eas.users.demos.oclrBlinken.BlinkScheduler

/*
* File name:        BlinkScheduler.java (package eas.simulation.users.lukas.oclrBlinken)
* Author(s):        Lukas König
* Java version:     6.0
* Generation date:  11.07.2011 (18:12:46)
*
* (c) This file and the EAS (Easy Agent Simulation) framework containing it
* is protected by Creative Commons by-nc-sa license. Any altered or
* further developed versions of this file have to meet the agreements
* stated by the license conditions.
*
* In a nutshell
* -------------
* You are free:
* - to Share -- to copy, distribute and transmit the work
* - to Remix -- to adapt the work
*
* Under the following conditions:
* - Attribution -- You must attribute the work in the manner specified by the
*   author or licensor (but not in any way that suggests that they endorse
*   you or your use of the work).
* - Noncommercial -- You may not use this work for commercial purposes.
* - Share Alike -- If you alter, transform, or build upon this work, you may
*   distribute the resulting work only under the same or a similar license to
*   this one.
*
* + Detailed license conditions (Germany):
*   http://creativecommons.org/licenses/by-nc-sa/3.0/de/
* + Detailed license conditions (unported):
*   http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en
*
* This header must be placed in the beginning of any version of this file.
*/

package eas.users.demos.oclrBlinken;

import java.util.Random;

import eas.math.geometry.Vector2D;
import eas.plugins.PluginProperties;
import eas.plugins.masterScheduler.AbstractDefaultMaster;
import eas.simulation.ConstantsSimulation;
import eas.simulation.spatial.sim2D.standardAgents.AbstractAgent2D;
import eas.simulation.spatial.sim2D.standardEnvironments.AbstractEnvironment2DFast;
import eas.simulation.spatial.sim2D.standardScenes.ObstacleRecursiveScene;
import eas.simulation.spatial.standardBrains.marb.MARBBrain;
import eas.startSetup.ParCollection;

/**
* @author Lukas König
*
*/
@PluginProperties(pluginIsHidden = true)
public class BlinkScheduler extends AbstractDefaultMaster<AbstractEnvironment2DFast<AbstractAgent2D<?>>> {

    /**
     *
     */
    private static final long serialVersionUID = -3341671067231011784L;

    @SuppressWarnings("unchecked")
    @Override
    public AbstractEnvironment2DFast<AbstractAgent2D<?>>[] generateRunnables(
            ParCollection params) {
        @SuppressWarnings({ "rawtypes" })
        AbstractEnvironment2DFast<AbstractAgent2D<?>> env = new AbstractEnvironment2DFast(0, params) {

            /**
             *
             */
            private static final long serialVersionUID = 5850242073723112547L;};
       
        Random rand = new Random(0);
       
        env.addScene(new ObstacleRecursiveScene(params));
       
        for (int i = 0; i < 20; i++) {
            Roboter r = new Roboter(10 + i, env, rand, params, false, 360);
            MARBBrain<Roboter> b = new MARBBrain<Roboter>(r, params);
            b.getMarb().erzeugeAusStdSequenz("002, 003, 003, 250, 000, 012, 001, 002, 000, 005, 000, 012, 004, 004, 000, 007, 000, 011, 000, 012, 001, 002, 000, 005, 000, 012, 004, 000, 012, 005, 000, 006, 000, 010, 000, 012, 003, 001, 000, 004, 000, 011, 000, 011, 000, 000, 005, 001, 000, 000, 000, 005, 004, 001, 001, 000, 000, 000");
            r.implantBrain(b);
            env.addCollidingAgent(r, new Vector2D(400 + i * 30, 200 - i * 30), rand.nextDouble() * 360);
        }
       
        return new AbstractEnvironment2DFast[] {env};
    }

    @Override
    public String id() {
        return ConstantsSimulation.DEFAULT_MASTER_SCHEDULER_ID + "-BlinkMaster";
    }
}
TOP

Related Classes of eas.users.demos.oclrBlinken.BlinkScheduler

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.