Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * **********************************************************************
- * Declaración de variables
- *
- * **********************************************************************
- */
- public static Thread t;
- private int separacion = 0;
- private float Qhec;
- private float velocidad;
- private boolean suspendFlag;
- public Hilo1() {
- t = new Thread(this);
- Qhec = 0;
- t.start(); // Comienza el hilo
- }
- public void run() {
- while (true) {
- try {
- calcularCaudalHectareo(xx);//En xx iria el numero a evaluar
- t.sleep(1500);
- synchronized (this) {
- while (suspendFlag) {
- wait();
- }
- }
- } catch (InterruptedException ex) {
- Logger.getLogger(HiloMapear.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
- public void mysuspend() {
- suspendFlag = true;
- }
- public synchronized void myresume() {
- suspendFlag = false;
- notify();
- }
- public void calcularCaudalHectareo(double QHorario) throws IOException {
- velocidad = pp.central.getVelocidad();//Pp es el objeto desde donde traigo la velocidad actualizada
- if (velocidad == 0 || separacion == 0) {
- Qhec = 0;
- } else {
- Qhec = (float) ((QHorario * 60) / (separacion * velocidad));
- }
- this.pp.ce.setCaudal(Qhec);//Seteo al objeto pp el caudal obtenido
- }
Add Comment
Please, Sign In to add comment