@Override public int hashCode() { int hc = 0; int len = size(); for (int i = 0; i < len; i++) { // make Pattern comparisons case insensitive // http://jira.qos.ch/browse/LBCORE-76 hc ^= get(i).toLowerCase().hashCode(); } return hc; }
@Override public int hashCode() { int hc = 0; int len = size(); for (int i = 0; i < len; i++) { // make Pattern comparisons case insensitive // http://jira.qos.ch/browse/LBCORE-76 hc ^= get(i).toLowerCase().hashCode(); } return hc; }
@Override public int hashCode() { int hc = 0; int len = size(); for (int i = 0; i < len; i++) { // make Pattern comparisons case insensitive // http://jira.qos.ch/browse/LBCORE-76 hc ^= get(i).toLowerCase().hashCode(); } return hc; }
@Override public boolean equals(Object o) { if ((o == null) || !(o instanceof Pattern)) { return false; } Pattern r = (Pattern) o; if (r.size() != size()) { return false; } int len = size(); for (int i = 0; i < len; i++) { if (!equalityCheck(get(i), r.get(i))) { return false; } } // if everything matches, then the two patterns are equal return true; }
@Override public boolean equals(Object o) { if ((o == null) || !(o instanceof Pattern)) { return false; } Pattern r = (Pattern) o; if (r.size() != size()) { return false; } int len = size(); for (int i = 0; i < len; i++) { if (!equalityCheck(get(i), r.get(i))) { return false; } } // if everything matches, then the two patterns are equal return true; }
@Override public boolean equals(Object o) { if ((o == null) || !(o instanceof Pattern)) { return false; } Pattern r = (Pattern) o; if (r.size() != size()) { return false; } int len = size(); for (int i = 0; i < len; i++) { if (!equalityCheck(get(i), r.get(i))) { return false; } } // if everything matches, then the two patterns are equal return true; }
List tailMatch(Pattern currentPattern) { int max = 0; Pattern longestMatchingPattern = null; for (Pattern p : rules.keySet()) { if ((p.size() > 1) && p.get(0).equals(ANY)) { int r = currentPattern.getTailMatchLength(p); if (r > max) { max = r; longestMatchingPattern = p; } } } if (longestMatchingPattern != null) { return rules.get(longestMatchingPattern); } else { return null; } }
List tailMatch(Pattern currentPattern) { int max = 0; Pattern longestMatchingPattern = null; for (Pattern p : rules.keySet()) { if ((p.size() > 1) && p.get(0).equals(ANY)) { int r = currentPattern.getTailMatchLength(p); if (r > max) { max = r; longestMatchingPattern = p; } } } if (longestMatchingPattern != null) { return rules.get(longestMatchingPattern); } else { return null; } }
List prefixMatch(Pattern currentPattern) { int max = 0; Pattern longestMatchingPattern = null; for (Pattern p : rules.keySet()) { String last = p.peekLast(); if (ANY.equals(last)) { int r = currentPattern.getPrefixMatchLength(p); // to qualify the match length must equal p's size omitting the '*' if ((r == p.size() - 1) && (r > max)) { // System.out.println("New longest prefixMatch "+p); max = r; longestMatchingPattern = p; } } } if (longestMatchingPattern != null) { return rules.get(longestMatchingPattern); } else { return null; } }
List tailMatch(Pattern currentPattern) { int max = 0; Pattern longestMatchingPattern = null; for (Pattern p : rules.keySet()) { if ((p.size() > 1) && p.get(0).equals("*")) { int r = currentPattern.getTailMatchLength(p); // System.out.println("tailMatch " +r); if (r > max) { // System.out.println("New longest tailMatch "+p); max = r; longestMatchingPattern = p; } } } if (longestMatchingPattern != null) { return rules.get(longestMatchingPattern); } else { return null; } }
List prefixMatch(Pattern currentPattern) { int max = 0; Pattern longestMatchingPattern = null; for (Pattern p : rules.keySet()) { String last = p.peekLast(); if (ANY.equals(last)) { int r = currentPattern.getPrefixMatchLength(p); // to qualify the match length must equal p's size omitting the '*' if ((r == p.size() - 1) && (r > max)) { // System.out.println("New longest prefixMatch "+p); max = r; longestMatchingPattern = p; } } } if (longestMatchingPattern != null) { return rules.get(longestMatchingPattern); } else { return null; } }
List prefixMatch(Pattern currentPattern) { int max = 0; Pattern longestMatchingPattern = null; for (Pattern p : rules.keySet()) { String last = p.peekLast(); if ("*".equals(last)) { int r = currentPattern.getPrefixMatchLength(p); // System.out.println("r = "+ r + ", p= "+p); // to qualify the match length must equal p's size omitting the '*' if ((r == p.size() - 1) && (r > max)) { // System.out.println("New longest prefixMatch "+p); max = r; longestMatchingPattern = p; } } } if (longestMatchingPattern != null) { // System.out.println("prefixMatch will return" // +rules.get(longestMatchingPattern)); return rules.get(longestMatchingPattern); } else { return null; } }