Class QueryGraphCPQ.Row

java.lang.Object
dev.roanh.gmark.lang.cpq.QueryGraphCPQ.Row
Enclosing class:
QueryGraphCPQ

private static final class QueryGraphCPQ.Row extends Object
A row instance represents a single potential homomorphism mapping for a partial map. A row also tracks information about past attributes that are required to construct a complete homomorphism mapping.
See Also:
  • Field Details

  • Constructor Details

    • Row

      private Row(int size)
      Constructs a new row with space for the given number of mapping targets.
      Parameters:
      size - The number of mapping targets to allocate space for.
  • Method Details

    • computeBestUsage

      private void computeBestUsage(int size)
      Computes the best usage for this row. This is the selection of options from the option sets in other that together with match results in the mapping with the smallest number of distinct targets. For this computation exactly one option from each option set has to be used. The result of this computation is stored in #best and its cost in #cost.
      Parameters:
      size - The size of the entire original query graph as the combined count of vertices and edges.
    • computeBestUsage

      private void computeBestUsage(int offset, BitSet workSet, int size)
      Computes the best usage for this row. This is the selection of options from the option sets in other that together with match results in the mapping with the smallest number of distinct targets. For this computation exactly one option from each option set has to be used. The result of this computation is stored in #best and its cost in #cost.
      Parameters:
      offset - The current option set to pick from.
      workSet - The set of picked mappings so far encoded as a bit set with bits set based on component IDs.
      size - The size of the entire original query graph as the combined count of vertices and edges.
    • updateBest

      private void updateBest(BitSet used)
      Updates best mapping candidate for this row with the given candidate if this candidate has a lower cost than the current best candidate. The cost is evaluated as the total number of distinct mapping targets.
      Parameters:
      used - A set of picked mappings that together form the complete candidate encoded as a bit set with bits set based on component IDs.
    • get

      public QueryGraphCPQ.QueryGraphComponent get(int idx)
      Gets the match component at the given index.
      Parameters:
      idx - The index to get.
      Returns:
      The match component at the given index.
    • add

      public void add(QueryGraphCPQ.QueryGraphComponent comp)
      Adds a new match component to this row.
      Parameters:
      comp - The component to append.
    • toString

      public String toString()
      Overrides:
      toString in class Object