@ Deprecated public Collection < String > getRedundants ( Collection < String > output ) { synchronized ( this ) { // synchronized since a getter must be thread-safe if ( output == null ) { output = new LinkedHashSet < String > ( ) ; } for ( DateTimeMatcher cur : skeleton2pattern . keySet ( ) ) { PatternWithSkeletonFlag patternWithSkelFlag = skeleton2pattern . get ( cur ) ; String pattern = patternWithSkelFlag . pattern ; if ( CANONICAL_SET . contains ( pattern ) ) { continue ; } String trial = getBestPattern ( cur . toString ( ) , cur , MATCH_NO_OPTIONS ) ; if ( trial . equals ( pattern ) ) { output . add ( pattern ) ; } } ///CLOVER:OFF //The following would never be called since the parameter is false //Eclipse stated the following is "dead code" /*if (false) { // ordered DateTimePatternGenerator results = new DateTimePatternGenerator(); PatternInfo pinfo = new PatternInfo(); for (DateTimeMatcher cur : skeleton2pattern.keySet()) { String pattern = skeleton2pattern.get(cur); if (CANONICAL_SET.contains(pattern)) { continue; } //skipMatcher = current; String trial = results.getBestPattern(cur.toString()); if (trial.equals(pattern)) { output.add(pattern); } else { results.addPattern(pattern, false, pinfo); } } }*/ ///CLOVER:ON return output ; } }
Redundant patterns are those which if removed make no difference in the resulting getBestPattern values . This method returns a list of them to help check the consistency of the patterns used to build this generator .