@Override public int compareTo(Pattern cr2) { long support2 = cr2.support(); int length2 = cr2.length(); if (support == support2) { if (length < length2) { return -1; } else if (length > length2) { return 1; } else { return 0; } } else { return support > support2 ? 1 : -1; } }
public final boolean isSubPatternOf(Pattern frequentPattern) { int[] otherPattern = frequentPattern.getPattern(); int otherLength = frequentPattern.length(); if (this.length() > frequentPattern.length()) { return false; } int i = 0; int otherI = 0; while (i < length && otherI < otherLength) { if (otherPattern[otherI] == pattern[i]) { otherI++; i++; } else if (otherPattern[otherI] < pattern[i]) { otherI++; } else { return false; } } return otherI != otherLength || i == length; }