@Override public Sample read() throws CommonException, SampleModelSizeException { Sample result = null; this.checkSize(); try { result = reader.read(); } catch (CMException e) { throw new CommonException(e.getMessage()); } catch (DataTypeUnsupportedException de) { throw new CommonException(de.getMessage()); } if (result != null) { boolean added; if (structDetail != null) { added = this.addSample(result, structDetail); } else { added = this.addSample(result); } if (added && (result != null)) { this.notifyListeners("data_read"); } } else { this.notifyListeners("no_data_available"); } return result; }
public ReaderSampleModel(Reader _reader, String struct) throws CommonException { super(); structDetail = struct; if (_reader == null) { throw new CommonException("Supplied reader == null."); } reader = _reader; try { userDataModel = new UserDataTableModel(reader.getDataType(), struct); singleUserDataModel = new UserDataSingleTableModel(reader.getDataType(), false, struct); } catch (CMException e) { throw new CommonException(e.getMessage()); } catch (DataTypeUnsupportedException de) { throw new CommonException(de.getMessage()); } }
/** * Constructs the model for the supplied Reader. * * @param _reader The Reader where data is read/taken from. * @throws CMException Thrown when the reader is no longer available or the data type of its * contents cannot be found. */ public ReaderSampleModel(Reader _reader) throws CommonException { super(); if (_reader == null) { throw new CommonException("Supplied reader == null."); } reader = _reader; try { userDataModel = new UserDataTableModel(reader.getDataType()); singleUserDataModel = new UserDataSingleTableModel(reader.getDataType(), false); this.initiateToBeWrittenUserData(new UserData(reader.getDataType())); } catch (CMException e) { throw new CommonException(e.getMessage()); } catch (DataTypeUnsupportedException de) { throw new CommonException(de.getMessage()); } }