Package org.rioproject.examples.hospital

Examples of org.rioproject.examples.hospital.CalculablePatient


       
        public void run() {
            Service s = getService();
            if(s!=null) {
                try {
                    CalculablePatient c = checkAdd(s, "pulse", lastPulse);
                    if(c!=null) {
                        lastPulse = c;
                        pulseTimeSeries.addOrUpdate(new FixedMillisecond(c.getWhen()), c.getValue());
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
                try {
                    Calculable c = checkAdd(s, "temperature", lastTemperature);
                    if(c!=null) {
                        lastTemperature = c;
                        temperatureTimeSeries.addOrUpdate(new FixedMillisecond(c.getWhen()), c.getValue());
                    }
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
View Full Code Here


        }

        private CalculablePatient checkAdd(Service s, String watch, Calculable lastOne) throws
                                                                              RemoteException {
            WatchDataSource wds = s.fetch(watch);
            CalculablePatient c = (CalculablePatient)wds.getLastCalculable();
            Date lastMeasurement = new Date(lastOne.getWhen());
            Date currentMeasurement = new Date(c.getWhen());
            return currentMeasurement.after(lastMeasurement)?c:null;
        }
View Full Code Here

    }

    class FeederTask implements Runnable {

        public void run() {
            pulse.addWatchRecord(new CalculablePatient(pulse.getId(),
                                                       patient.getCurrentPulse(),
                                                       patient));
            temperature.addWatchRecord(new CalculablePatient(temperature.getId(),
                                                             patient.getCurrentTemperature(),
                                                             patient));
        }
View Full Code Here

TOP

Related Classes of org.rioproject.examples.hospital.CalculablePatient

Copyright © 2018 www.massapicom. 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.