Package com.zinep.utils

Source Code of com.zinep.utils.Pruebas

package com.zinep.utils;

import com.zinep.*;
import com.zinep.script.Simulacion;
import com.zinep.sucursales.Local;
import com.zinep.trans.Deposito;
import com.zinep.trans.Retiro;
import java.util.Arrays;
import java.util.Random;

/**
*
* @author tomas
*/
public class Pruebas {

    public static void main(String[] args) {
        final TimeManager tiempo = TimeManager.get();

        Monto montoEnUYU = new Monto(100000L, Moneda.UYU);
        Monto montoEnUSD = new Monto(100000L, Moneda.UYU);

        final Sucursal sucursal = new Local("Central", montoEnUYU, montoEnUSD);
        final Banco banco = new Banco("Zinep", Arrays.asList(sucursal));

        for (Agente agente : sucursal.getAgentes()) {
            tiempo.add(agente);
        }

        Trabajador generadorClientes = new Trabajador() {

            private final Random random = new Random(12345L);
            private int contador = 0;

            @Override
            protected void ejecutar() {
                final Cuenta cuenta = new Cuenta(Moneda.UYU) {
                };
                final Cliente cliente = new Cliente(random.nextBoolean(), Arrays.asList(cuenta));
                cliente.addAll(sucursal, Deposito.efectuarDeposito(cliente, cuenta, sucursal, new Monto(-1, Moneda.UYU)));
                cliente.addAll(sucursal, Retiro.crearRetiro(cliente, cuenta, sucursal, new Monto(1000, Moneda.UYU)));
                sucursal.entraCliente(cliente);

                if (contador++ >= 10) {
                    detener();
                }
            }
        };

        tiempo.add(generadorClientes);
        tiempo.add(sucursal);

        tiempo.start();
    }
   
    public static void correr(Banco banco, Sucursal sucursal, Simulacion simulacion) {
       
    }
}
TOP

Related Classes of com.zinep.utils.Pruebas

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.