IAnalysisResultRequester<I extends IInputUnit, A extends IAnalyzeUnit>¶
Interface for requesting single analysis results or updates for analysis results.
- <P> – Type of parse units.
- <A> – Type of analyze units.
request(I input, IContext context)¶
Requests the analysis result for given resource. When subscribing to the returned observer, it always returns a single element; the latest analysis result, or pushes an error if an error occurred while getting it. If the analysis result is cached, the observable will immediately push it. If the analysis result has been invalidated (when it is in the process of being updated), it will be pushed when it has been updated. If there is no analysis result yet, it will request a parse result, analyze the resource in given context, and push the analysis result. The simplest way to get the analysis result is to wait for it:
result = requester.request(resource, context, text).toBlocking().single();
- resource – Resource to get the analysis result for.
- context – Context in which the analysis should be performed, in case there is no analysis result for given resource.
- text – Text which should be parsed, in case there is no parse result for given resource.
Cold observable which pushes a single element when subscribed; the latest analysis result, or pushes an error if an error occurred while getting it.