Class FlowThroughComm.Matcher

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

public static class FlowThroughComm.Matcher extends org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<FlowThroughComm.Match>
Generated pattern matcher API of the be.kuleuven.cs.distrinet.sparta.queries.flowThroughComm 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 FlowThroughComm.Match.

Original source:

 ///////////////////// Pattern variants which require crossing the trust boundary /////////////////////
 //
 // The Through pattern variants (contrary to the to variants) require the flow to cross a trust
 // boundary.
 //
 ///////////////////// ////////////////////////////////////////////////////////// /////////////////////
 pattern flowThroughComm(location : DataFlow, p : DataFlowEntity, p2 : DataFlowEntity,
                                                        t : ThreatType) {
        DataFlow(location);DataFlowEntity(p);DataFlowEntity(p2);
 
        find threatApplicable(location,t,"DataFlowThrough");
        find communication(p,location,p2);
        find flowContainerDiff(p,p2);
 } or {
        Process(p);
        Process(p2);
        find threatApplicable(location,t,"ProcessThroughProcess");
        find communication(p,location,p2);
        find flowContainerDiff(p,p2);
 } or {
        Process(p);
        DataStore(p2);
        find threatApplicable(location,t,"ProcessThroughDataStore");
        find communication(p,location,p2);
        find flowContainerDiff(p,p2);
 } or {
        DataStore(p);
        Process(p2);
        find threatApplicable(location,t,"DataStoreThroughProcess");
        find communication(p,location,p2);
        find flowContainerDiff(p,p2);
 } or {
        Process(p);
        ExternalEntity(p2);
        find threatApplicable(location,t,"ProcessThroughExternalEntity");
        find communication(p,location,p2);
        find flowContainerDiff(p,p2);
 } or {
        ExternalEntity(p);
        Process(p2);
        find threatApplicable(location,t,"ExternalEntityThroughProcess");
        find communication(p,location,p2);
        find flowContainerDiff(p,p2);
 }
 
See Also:
  • Method Details

    • on

      public static FlowThroughComm.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 FlowThroughComm.Matcher create()
      Returns:
      an initialized matcher
    • getAllMatches

      public Collection<FlowThroughComm.Match> getAllMatches(DataFlow pLocation, DataFlowEntity pP, DataFlowEntity pP2, ThreatType pT)
      Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
      Parameters:
      pLocation - the fixed value of pattern parameter location, or null if not bound.
      pP - the fixed value of pattern parameter p, or null if not bound.
      pP2 - the fixed value of pattern parameter p2, or null if not bound.
      pT - the fixed value of pattern parameter t, or null if not bound.
      Returns:
      matches represented as a Match object.
    • streamAllMatches

      public Stream<FlowThroughComm.Match> streamAllMatches(DataFlow pLocation, DataFlowEntity pP, DataFlowEntity pP2, ThreatType pT)
      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:
      pLocation - the fixed value of pattern parameter location, or null if not bound.
      pP - the fixed value of pattern parameter p, or null if not bound.
      pP2 - the fixed value of pattern parameter p2, or null if not bound.
      pT - the fixed value of pattern parameter t, or null if not bound.
      Returns:
      a stream of matches represented as a Match object.
    • getOneArbitraryMatch

      public Optional<FlowThroughComm.Match> getOneArbitraryMatch(DataFlow pLocation, DataFlowEntity pP, DataFlowEntity pP2, ThreatType pT)
      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:
      pLocation - the fixed value of pattern parameter location, or null if not bound.
      pP - the fixed value of pattern parameter p, or null if not bound.
      pP2 - the fixed value of pattern parameter p2, or null if not bound.
      pT - the fixed value of pattern parameter t, or null if not bound.
      Returns:
      a match represented as a Match object, or null if no match is found.
    • hasMatch

      public boolean hasMatch(DataFlow pLocation, DataFlowEntity pP, DataFlowEntity pP2, ThreatType pT)
      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:
      pLocation - the fixed value of pattern parameter location, or null if not bound.
      pP - the fixed value of pattern parameter p, or null if not bound.
      pP2 - the fixed value of pattern parameter p2, or null if not bound.
      pT - the fixed value of pattern parameter t, or null if not bound.
      Returns:
      true if the input is a valid (partial) match of the pattern.
    • countMatches

      public int countMatches(DataFlow pLocation, DataFlowEntity pP, DataFlowEntity pP2, ThreatType pT)
      Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
      Parameters:
      pLocation - the fixed value of pattern parameter location, or null if not bound.
      pP - the fixed value of pattern parameter p, or null if not bound.
      pP2 - the fixed value of pattern parameter p2, or null if not bound.
      pT - the fixed value of pattern parameter t, or null if not bound.
      Returns:
      the number of pattern matches found.
    • forOneArbitraryMatch

      public boolean forOneArbitraryMatch(DataFlow pLocation, DataFlowEntity pP, DataFlowEntity pP2, ThreatType pT, Consumer<? super FlowThroughComm.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:
      pLocation - the fixed value of pattern parameter location, or null if not bound.
      pP - the fixed value of pattern parameter p, or null if not bound.
      pP2 - the fixed value of pattern parameter p2, or null if not bound.
      pT - the fixed value of pattern parameter t, 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 FlowThroughComm.Match newMatch(DataFlow pLocation, DataFlowEntity pP, DataFlowEntity pP2, ThreatType pT)
      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:
      pLocation - the fixed value of pattern parameter location, or null if not bound.
      pP - the fixed value of pattern parameter p, or null if not bound.
      pP2 - the fixed value of pattern parameter p2, or null if not bound.
      pT - the fixed value of pattern parameter t, or null if not bound.
      Returns:
      the (partial) match object.
    • rawStreamAllValuesOflocation

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

      public Set<DataFlow> getAllValuesOflocation()
      Retrieve the set of values that occur in matches for location.
      Returns:
      the Set of all values or empty set if there are no matches
    • streamAllValuesOflocation

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

      public Stream<DataFlow> streamAllValuesOflocation(FlowThroughComm.Match partialMatch)
      Retrieve the set of values that occur in matches for location.

      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.
      Returns:
      the Stream of all values or empty set if there are no matches
    • streamAllValuesOflocation

      public Stream<DataFlow> streamAllValuesOflocation(DataFlowEntity pP, DataFlowEntity pP2, ThreatType pT)
      Retrieve the set of values that occur in matches for location.

      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.
      Returns:
      the Stream of all values or empty set if there are no matches
    • getAllValuesOflocation

      public Set<DataFlow> getAllValuesOflocation(FlowThroughComm.Match partialMatch)
      Retrieve the set of values that occur in matches for location.
      Returns:
      the Set of all values or empty set if there are no matches
    • getAllValuesOflocation

      public Set<DataFlow> getAllValuesOflocation(DataFlowEntity pP, DataFlowEntity pP2, ThreatType pT)
      Retrieve the set of values that occur in matches for location.
      Returns:
      the Set of all values or empty set if there are no matches
    • rawStreamAllValuesOfp

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

      public Set<DataFlowEntity> getAllValuesOfp()
      Retrieve the set of values that occur in matches for p.
      Returns:
      the Set of all values or empty set if there are no matches
    • streamAllValuesOfp

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

      public Stream<DataFlowEntity> streamAllValuesOfp(FlowThroughComm.Match partialMatch)
      Retrieve the set of values that occur in matches for p.

      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.
      Returns:
      the Stream of all values or empty set if there are no matches
    • streamAllValuesOfp

      public Stream<DataFlowEntity> streamAllValuesOfp(DataFlow pLocation, DataFlowEntity pP2, ThreatType pT)
      Retrieve the set of values that occur in matches for p.

      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.
      Returns:
      the Stream of all values or empty set if there are no matches
    • getAllValuesOfp

      public Set<DataFlowEntity> getAllValuesOfp(FlowThroughComm.Match partialMatch)
      Retrieve the set of values that occur in matches for p.
      Returns:
      the Set of all values or empty set if there are no matches
    • getAllValuesOfp

      public Set<DataFlowEntity> getAllValuesOfp(DataFlow pLocation, DataFlowEntity pP2, ThreatType pT)
      Retrieve the set of values that occur in matches for p.
      Returns:
      the Set of all values or empty set if there are no matches
    • rawStreamAllValuesOfp2

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

      public Set<DataFlowEntity> getAllValuesOfp2()
      Retrieve the set of values that occur in matches for p2.
      Returns:
      the Set of all values or empty set if there are no matches
    • streamAllValuesOfp2

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

      public Stream<DataFlowEntity> streamAllValuesOfp2(FlowThroughComm.Match partialMatch)
      Retrieve the set of values that occur in matches for p2.

      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.
      Returns:
      the Stream of all values or empty set if there are no matches
    • streamAllValuesOfp2

      public Stream<DataFlowEntity> streamAllValuesOfp2(DataFlow pLocation, DataFlowEntity pP, ThreatType pT)
      Retrieve the set of values that occur in matches for p2.

      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.
      Returns:
      the Stream of all values or empty set if there are no matches
    • getAllValuesOfp2

      public Set<DataFlowEntity> getAllValuesOfp2(FlowThroughComm.Match partialMatch)
      Retrieve the set of values that occur in matches for p2.
      Returns:
      the Set of all values or empty set if there are no matches
    • getAllValuesOfp2

      public Set<DataFlowEntity> getAllValuesOfp2(DataFlow pLocation, DataFlowEntity pP, ThreatType pT)
      Retrieve the set of values that occur in matches for p2.
      Returns:
      the Set of all values or empty set if there are no matches
    • rawStreamAllValuesOft

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

      public Set<ThreatType> getAllValuesOft()
      Retrieve the set of values that occur in matches for t.
      Returns:
      the Set of all values or empty set if there are no matches
    • streamAllValuesOft

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

      public Stream<ThreatType> streamAllValuesOft(FlowThroughComm.Match partialMatch)
      Retrieve the set of values that occur in matches for t.

      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.
      Returns:
      the Stream of all values or empty set if there are no matches
    • streamAllValuesOft

      public Stream<ThreatType> streamAllValuesOft(DataFlow pLocation, DataFlowEntity pP, DataFlowEntity pP2)
      Retrieve the set of values that occur in matches for t.

      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.
      Returns:
      the Stream of all values or empty set if there are no matches
    • getAllValuesOft

      public Set<ThreatType> getAllValuesOft(FlowThroughComm.Match partialMatch)
      Retrieve the set of values that occur in matches for t.
      Returns:
      the Set of all values or empty set if there are no matches
    • getAllValuesOft

      public Set<ThreatType> getAllValuesOft(DataFlow pLocation, DataFlowEntity pP, DataFlowEntity pP2)
      Retrieve the set of values that occur in matches for t.
      Returns:
      the Set of all values or empty set if there are no matches
    • tupleToMatch

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

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

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

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