Class DataSubjects.Matcher

java.lang.Object
org.eclipse.viatra.query.runtime.internal.apiimpl.QueryResultWrapper
org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<DataSubjects.Match>
be.kuleuven.cs.distrinet.sparta.queries.DataSubjects.Matcher
All Implemented Interfaces:
org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher<DataSubjects.Match>
Enclosing class:
DataSubjects

public static class DataSubjects.Matcher extends org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<DataSubjects.Match>
Generated pattern matcher API of the be.kuleuven.cs.distrinet.sparta.queries.dataSubjects pattern, providing pattern-specific query methods.

Use the pattern matcher on a given model via on(ViatraQueryEngine), e.g. in conjunction with ViatraQueryEngine.on(QueryScope).

Matches of the pattern will be represented as DataSubjects.Match.

Original source:

 pattern dataSubjects(ds : DataSubjectType) {
        DataSubjectType(ds);
 }
 
See Also:
  • Method Details

    • on

      public static DataSubjects.Matcher on(org.eclipse.viatra.query.runtime.api.ViatraQueryEngine engine)
      Initializes the pattern matcher within an existing VIATRA Query engine. If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
      Parameters:
      engine - the existing VIATRA Query engine in which this matcher will be created.
    • create

      public static DataSubjects.Matcher create()
      Returns:
      an initialized matcher
    • getAllMatches

      public Collection<DataSubjects.Match> getAllMatches(DataSubjectType pDs)
      Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
      Parameters:
      pDs - the fixed value of pattern parameter ds, or null if not bound.
      Returns:
      matches represented as a Match object.
    • streamAllMatches

      public Stream<DataSubjects.Match> streamAllMatches(DataSubjectType pDs)
      Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.

      NOTE: It is important not to modify the source model while the stream is being processed. If the match set of the pattern changes during processing, the contents of the stream is undefined. In such cases, either rely on BaseMatcher.getAllMatches() or collect the results of the stream in end-user code.
      Parameters:
      pDs - the fixed value of pattern parameter ds, or null if not bound.
      Returns:
      a stream of matches represented as a Match object.
    • getOneArbitraryMatch

      public Optional<DataSubjects.Match> getOneArbitraryMatch(DataSubjectType pDs)
      Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. Neither determinism nor randomness of selection is guaranteed.
      Parameters:
      pDs - the fixed value of pattern parameter ds, or null if not bound.
      Returns:
      a match represented as a Match object, or null if no match is found.
    • hasMatch

      public boolean hasMatch(DataSubjectType pDs)
      Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, under any possible substitution of the unspecified parameters (if any).
      Parameters:
      pDs - the fixed value of pattern parameter ds, or null if not bound.
      Returns:
      true if the input is a valid (partial) match of the pattern.
    • countMatches

      public int countMatches(DataSubjectType pDs)
      Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
      Parameters:
      pDs - the fixed value of pattern parameter ds, or null if not bound.
      Returns:
      the number of pattern matches found.
    • forOneArbitraryMatch

      public boolean forOneArbitraryMatch(DataSubjectType pDs, Consumer<? super DataSubjects.Match> processor)
      Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. Neither determinism nor randomness of selection is guaranteed.
      Parameters:
      pDs - the fixed value of pattern parameter ds, or null if not bound.
      processor - the action that will process the selected match.
      Returns:
      true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
    • newMatch

      public DataSubjects.Match newMatch(DataSubjectType pDs)
      Returns a new (partial) match. This can be used e.g. to call the matcher with a partial match.

      The returned match will be immutable. Use BaseMatcher.newEmptyMatch() to obtain a mutable match object.

      Parameters:
      pDs - the fixed value of pattern parameter ds, or null if not bound.
      Returns:
      the (partial) match object.
    • rawStreamAllValuesOfds

      protected Stream<DataSubjectType> rawStreamAllValuesOfds(Object[] parameters)
      Retrieve the set of values that occur in matches for ds.
      Returns:
      the Set of all values or empty set if there are no matches
    • getAllValuesOfds

      public Set<DataSubjectType> getAllValuesOfds()
      Retrieve the set of values that occur in matches for ds.
      Returns:
      the Set of all values or empty set if there are no matches
    • streamAllValuesOfds

      public Stream<DataSubjectType> streamAllValuesOfds()
      Retrieve the set of values that occur in matches for ds.
      Returns:
      the Set of all values or empty set if there are no matches
    • tupleToMatch

      protected DataSubjects.Match tupleToMatch(org.eclipse.viatra.query.runtime.matchers.tuple.Tuple t)
      Specified by:
      tupleToMatch in class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<DataSubjects.Match>
    • arrayToMatch

      protected DataSubjects.Match arrayToMatch(Object[] match)
      Specified by:
      arrayToMatch in class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<DataSubjects.Match>
    • arrayToMatchMutable

      protected DataSubjects.Match arrayToMatchMutable(Object[] match)
      Specified by:
      arrayToMatchMutable in class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<DataSubjects.Match>
    • querySpecification

      public static org.eclipse.viatra.query.runtime.api.IQuerySpecification<DataSubjects.Matcher> querySpecification()
      Returns:
      the singleton instance of the query specification of this pattern