Class ObservablePatternMatchCollectionBuilder<M extends IPatternMatch>
- java.lang.Object
-
- org.eclipse.viatra.addon.databinding.runtime.collection.ObservablePatternMatchCollectionBuilder<M>
-
public class ObservablePatternMatchCollectionBuilder<M extends IPatternMatch> extends java.lang.ObjectBuilder API for observable pattern match collections (lists and sets). This builder can be used for setting up complex observable collections including filtering, comparator or converter. Existing matchers or rule engines are supported together with configuration from query specification or VIATRA Query engine.-
Use the
create(org.eclipse.viatra.query.runtime.api.IQuerySpecification<? extends org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher<M>>)methods to initialize a builder with a given matcher or query specification. -
Use the set methods (
setEngine(org.eclipse.viatra.query.runtime.api.ViatraQueryEngine),setFilter(org.eclipse.viatra.transformation.evm.api.event.EventFilter<M>),setComparator(java.util.Comparator<M>),setConverter(java.util.function.Function<M, ?>)) to configure the builder. -
Finally, use the
buildList()andbuildSet()methods to create an observable list or set as required.
-
Use the
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedObservablePatternMatchCollectionBuilder(IQuerySpecification<? extends ViatraQueryMatcher<M>> specification)protectedObservablePatternMatchCollectionBuilder(ViatraQueryMatcher<M> matcher)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ObservablePatternMatchList<M>buildList()Builds anObservablePatternMatchListbased on the configuration set in the builder.ObservablePatternMatchSet<M>buildSet()Builds anObservablePatternMatchSetbased on the configuration set in the builder.static <M extends IPatternMatch>
ObservablePatternMatchCollectionBuilder<M>create(IQuerySpecification<? extends ViatraQueryMatcher<M>> specification)Creates a builder for configuring an observable collection observing the match set of the givenIQuerySpecificationstatic <M extends IPatternMatch>
ObservablePatternMatchCollectionBuilder<M>create(ViatraQueryMatcher<M> matcher)Creates a builder for configuring an observable collection observing the match set of the givenViatraQueryMatcher.ObservablePatternMatchCollectionBuilder<M>setComparator(java.util.Comparator<M> comparator)The given comparator is used to define the ordering between the elements in the built observable.ObservablePatternMatchCollectionBuilder<M>setConverter(java.util.function.Function<M,?> converter)The given converter function is used on each match and the end result is put into the observable collection.ObservablePatternMatchCollectionBuilder<M>setEngine(ViatraQueryEngine engine)Sets the givenViatraQueryEngineto be used as the engine of the built observable.ObservablePatternMatchCollectionBuilder<M>setEngine(RuleEngine engine)Sets the givenRuleEngineto be used as the engine of the built observable.ObservablePatternMatchCollectionBuilder<M>setFilter(java.util.Collection<M> multifilters, ViatraQueryFilterSemantics semantics)Sets the given collection of (partial) matches as an event filter with the given semantics used by the built observable collection.ObservablePatternMatchCollectionBuilder<M>setFilter(M filter)Sets the given (partial) match as an event filter used by the built observable collection.ObservablePatternMatchCollectionBuilder<M>setFilter(EventFilter<M> filter)Sets the event filter used by the built observable collection.
-
-
-
Constructor Detail
-
ObservablePatternMatchCollectionBuilder
protected ObservablePatternMatchCollectionBuilder(IQuerySpecification<? extends ViatraQueryMatcher<M>> specification)
-
ObservablePatternMatchCollectionBuilder
protected ObservablePatternMatchCollectionBuilder(ViatraQueryMatcher<M> matcher)
-
-
Method Detail
-
create
public static <M extends IPatternMatch> ObservablePatternMatchCollectionBuilder<M> create(IQuerySpecification<? extends ViatraQueryMatcher<M>> specification)
Creates a builder for configuring an observable collection observing the match set of the givenIQuerySpecification- Parameters:
specification- theIQuerySpecificationused to create a matcher
-
create
public static <M extends IPatternMatch> ObservablePatternMatchCollectionBuilder<M> create(ViatraQueryMatcher<M> matcher)
Creates a builder for configuring an observable collection observing the match set of the givenViatraQueryMatcher.- Parameters:
matcher- theViatraQueryMatcherto use as the source of the observable collection
-
setFilter
public ObservablePatternMatchCollectionBuilder<M> setFilter(EventFilter<M> filter)
Sets the event filter used by the built observable collection.
-
setFilter
public ObservablePatternMatchCollectionBuilder<M> setFilter(M filter)
Sets the given (partial) match as an event filter used by the built observable collection.
-
setFilter
public ObservablePatternMatchCollectionBuilder<M> setFilter(java.util.Collection<M> multifilters, ViatraQueryFilterSemantics semantics)
Sets the given collection of (partial) matches as an event filter with the given semantics used by the built observable collection.
-
setEngine
public ObservablePatternMatchCollectionBuilder<M> setEngine(ViatraQueryEngine engine)
Sets the givenViatraQueryEngineto be used as the engine of the built observable.
-
setEngine
public ObservablePatternMatchCollectionBuilder<M> setEngine(RuleEngine engine)
Sets the givenRuleEngineto be used as the engine of the built observable.
-
setComparator
public ObservablePatternMatchCollectionBuilder<M> setComparator(java.util.Comparator<M> comparator)
The given comparator is used to define the ordering between the elements in the built observable.
-
setConverter
public ObservablePatternMatchCollectionBuilder<M> setConverter(java.util.function.Function<M,?> converter)
The given converter function is used on each match and the end result is put into the observable collection.- Since:
- 2.0
-
buildList
public ObservablePatternMatchList<M> buildList()
Builds anObservablePatternMatchListbased on the configuration set in the builder.
-
buildSet
public ObservablePatternMatchSet<M> buildSet()
Builds anObservablePatternMatchSetbased on the configuration set in the builder.
-
-