X13XmlProcessor { public XmlInformationSet process(XmlRegArimaRequest request) { RegArimaSpecification 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 = RegArimaProcessingFactory.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(XmlRegArimaRequest request); XmlInformationSet process(XmlX13Request request); XmlInformationSet process(final XmlRegArimaRequests request); XmlInformationSet process(XmlX13Requests request); static RegArimaSpecification specification(XmlRegArimaAtomicRequest request); static ProcessingContext context(XmlProcessingContext ctx); static X13Specification specification(XmlX13AtomicRequest request);  }
@Test public void testRegArimaRequest() { XmlRegArimaRequest request = new XmlRegArimaRequest(); request.defaultSpecification = "RG5c"; 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"); X13XmlProcessor processor = new X13XmlProcessor(); XmlInformationSet rslt = processor.process(request); InformationSet all = rslt.create(); assertTrue(all.get("y_f", TsData.class) != null); }
@Test public void testRegArimaRequests() { long t0 = System.currentTimeMillis(); int N = 3; XmlRegArimaRequests requests = new XmlRegArimaRequests(); for (int i = 0; i < N; ++i) { XmlRegArimaAtomicRequest cur = new XmlRegArimaAtomicRequest(); cur.defaultSpecification = "RG5c"; cur.series = new XmlTs(); XmlTsData.MARSHALLER.marshal(Data.P, cur.series); requests.getItems().add(cur); } requests.getOutputFilter().add("likelihood.*"); X13XmlProcessor processor = new X13XmlProcessor(); XmlInformationSet rslt = processor.process(requests); long t1 = System.currentTimeMillis(); InformationSet all = rslt.create(); for (int i = 0; i < N; ++i) { assertTrue(null != all.search("series" + (i + 1) + ".likelihood.aic", Double.class)); } }
@Test public void testX13Requests() { long t0 = System.currentTimeMillis(); int N = 3; XmlX13Requests requests = new XmlX13Requests(); requests.setFlat(true); for (int i = 0; i < N; ++i) { XmlX13AtomicRequest cur = new XmlX13AtomicRequest(); cur.defaultSpecification = "RSA5c"; cur.series = new XmlTs(); XmlTsData.MARSHALLER.marshal(Data.P, cur.series); requests.getItems().add(cur); } X13XmlProcessor processor = new X13XmlProcessor(); XmlInformationSet rslt = processor.process(requests); long t1 = System.currentTimeMillis(); InformationSet all = rslt.create(); for (int i = 0; i < N; ++i) { assertTrue(null != all.search("series" + (i + 1) + ".final.sa", TsData.class)); } }