! ! ! e.printStackTrace();
! ! } catch (IllegalTransition e) {
! ! ! e.printStackTrace();
!!}
!!
!}
! /**
! * Reads the next value from the input file and sends it back into the process
! * as the s parameter. It terminates when it reaches the end of the input or
! * if any exception is found during its processing of the input.
! * When this happens, it throws EndOfSetException into the process.
! * @throws AMSException if it can't communicate with its agenda
! * @throws IllegalTransition if the step cannot be completed or terminated
! */
! private void readS() throws AMSException, IllegalTransition {
! ! try {
! ! ! // Read in a line of data
! ! ! System.out.print("(ReadSHandler) Assigning SensorData object: ");
! ! ! String line;
!!!
! ! ! // Read in next line of file
! ! ! line = reader.readLine();
!!!if (line == null || line.equals("")){
! ! ! ! terminate();
! ! ! ! return;
!!!}
! ! ! SensorData data = new SensorData (line);
!!!item.setParameter("s", data);
!!!item.complete();
!!!
! ! } catch (Exception e) {
! ! ! e.printStackTrace();
! ! ! terminate();
!!}
!}
! /**
! * Terminate the step, throwing the EndOfSetException into the process
! * @throws AMSException if it can't communicate with the agenda
! * @throws IllegalTransition if it can't terminate the step
! */
! private void terminate()
!!!throws AMSException, IllegalTransition {
! ! Set<Serializable> exceptions = new HashSet<Serializable>();
! ! exceptions.add (new EndOfSetException());
!!item.terminate(exceptions);
! ! return;
!}
!
}
Commentaires sur ces manuels