TramoSeatsXmlProcessor { public XmlInformationSet process(XmlTramoRequest request) { TramoSpecification spec = specification(request); Ts s = XmlTs.TS_UNMARSHALLER.unmarshal(request.series); if (s == null) { return null; } if (s.hasData() == TsStatus.Undefined) { s.load(TsInformationType.Data); } if (spec == null || s.getTsData() == null) { return null; } ProcessingContext ctx = context(request.context); IProcessing<TsData, PreprocessingModel> processing = TramoProcessingFactory.instance.generateProcessing(spec, ctx); PreprocessingModel model = processing.process(s.getTsData()); TreeSet<String> set = new TreeSet<>(); List<String> items = request.getOutputFilter(); set.addAll(items); InformationSet info = InformationSetHelper.fromProcResults(model, set); XmlInformationSet xinfo = new XmlInformationSet(); if (request.getFlat()) { xinfo.flatCopy(info); } else { xinfo.copy(info); } return xinfo; }  XmlInformationSet process(XmlTramoRequest request); XmlInformationSet process(XmlTramoSeatsRequest request); XmlInformationSet process(final XmlTramoRequests request); XmlInformationSet process(XmlTramoSeatsRequests request); static TramoSpecification specification(XmlTramoAtomicRequest request); static ProcessingContext context(XmlProcessingContext ctx); static TramoSeatsSpecification specification(XmlTramoSeatsAtomicRequest request);  }
@Test public void testTramoRequest() { XmlTramoRequest request = new XmlTramoRequest(); request.defaultSpecification = "TRfull"; request.series = new XmlTs(); XmlTsData.MARSHALLER.marshal(Data.X, request.series); request.getOutputFilter().add("arima.*"); request.getOutputFilter().add("likelihood.*"); request.getOutputFilter().add("residuals.*"); request.getOutputFilter().add("*_f"); TramoSeatsXmlProcessor processor = new TramoSeatsXmlProcessor(); XmlInformationSet rslt = processor.process(request); InformationSet all = rslt.create(); assertTrue(all.get("y_f", TsData.class) != null); }
@Test public void testTramoRequests() { int N = 10; XmlTramoRequests requests = new XmlTramoRequests(); for (int i = 0; i < N; ++i) { XmlTramoAtomicRequest cur = new XmlTramoAtomicRequest(); cur.defaultSpecification = "TRfull"; cur.series = new XmlTs(); XmlTsData.MARSHALLER.marshal(Data.P, cur.series); cur.series.setName("P"+i); requests.getItems().add(cur); } requests.getOutputFilter().add("likelihood.*"); TramoSeatsXmlProcessor processor = new TramoSeatsXmlProcessor(); XmlInformationSet rslt = processor.process(requests); InformationSet all = rslt.create(); for (int i = 0; i < N; ++i) { assertTrue(null != all.search("P" + i + ".likelihood.aic", Double.class)); } }
@Test public void testTramoSeatsRequests() { int N = 10; XmlTramoSeatsRequests requests = new XmlTramoSeatsRequests(); requests.setFlat(true); for (int i = 0; i < N; ++i) { XmlTramoSeatsAtomicRequest cur = new XmlTramoSeatsAtomicRequest(); cur.defaultSpecification = "RSAfull"; cur.series = new XmlTs(); XmlTsData.MARSHALLER.marshal(Data.P, cur.series); requests.getItems().add(cur); } TramoSeatsXmlProcessor processor = new TramoSeatsXmlProcessor(); XmlInformationSet rslt = processor.process(requests); InformationSet all = rslt.create(); for (int i = 0; i < N; ++i) { assertTrue(null != all.search("series" + (i + 1) + ".final.sa", TsData.class)); } }