IParseResultRequester

public interface IParseResultRequester<I extends IInputUnit, P extends IParseUnit>

Interface for requesting single parse results or updates for parse results.

Methods

get

P get(FileObject resource)
Returns:Latest parse result for given resource, or null if there is none.

request

Observable<P> request(I unit)

Requests the parse result for given resource. When subscribing to the returned observer, it always returns a single element; the latest parse result, or pushes an error if an error occurred while getting it. If the parse result is cached, the observable will immediately push it. If the parse 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 parse result yet, it will parse with given text and push the parse result. The simplest way to get the parse result is to wait for it: result = requester.request(resource, language, text).toBlocking().single();

Parameters:
  • resource – Resource to get the parse result for.
  • language – Language given text should be parsed with, in case there is no parse result for given resource.
  • text – Text which should be parsed, in case there is no parse result for given resource.
Returns:

Cold observable which pushes a single element when subscribed; the latest parse result, or pushes an error if an error occurred while getting it.

updates

Observable<ParseChange<P>> updates(FileObject resource)

Returns an observable that pushes parse result updates to subscribers for given resource.

Parameters:
  • resource – Resource to push updates for.
Returns:

Hot observable that pushes updates to subscribers for given resource.