예제 #1
0
 /**
  * Would factoring out this suffix result in elimating the reference source vertex?
  *
  * @param graph the graph
  * @param commonSuffix the common suffix of all toSplits
  * @param toSplits the list of vertices we're are trying to split
  * @return true if toSplit contains the reference source and this ref source has all and only the
  *     bases of commonSuffix
  */
 private boolean wouldEliminateRefSource(
     final SeqGraph graph, final SeqVertex commonSuffix, final Collection<SeqVertex> toSplits) {
   for (final SeqVertex toSplit : toSplits) {
     if (graph.isRefSource(toSplit)) return toSplit.length() == commonSuffix.length();
   }
   return false;
 }
예제 #2
0
  /**
   * Would all vertices that we'd split just result in the common suffix?
   *
   * <p>That is, suppose we have prefix nodes ABC and ABC. After splitting all of the vertices would
   * just be ABC again, and we'd enter into an infinite loop.
   *
   * @param commonSuffix the common suffix of all vertices in toSplits
   * @param toSplits the collection of vertices we want to split
   * @return true if all of the vertices are equal to the common suffix
   */
  private boolean allVerticesAreTheCommonSuffix(
      final SeqVertex commonSuffix, final Collection<SeqVertex> toSplits) {
    for (final SeqVertex toSplit : toSplits) {
      if (toSplit.length() != commonSuffix.length()) return false;
    }

    return true;
  }