protected boolean doesCommentMatch ( final Comment comment , final CSNodeWrapper node , boolean matchContent ) { if ( ! node . getNodeType ( ) . equals ( CommonConstants . CS_NODE_COMMENT ) ) return false ; // If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare if ( comment . getUniqueId ( ) != null && comment . getUniqueId ( ) . matches ( "^\\d.*" ) ) { return comment . getUniqueId ( ) . equals ( Integer . toString ( node . getId ( ) ) ) ; } else if ( matchContent ) { return StringUtilities . similarDamerauLevenshtein ( comment . getText ( ) , node . getTitle ( ) ) >= ProcessorConstants . MIN_MATCH_SIMILARITY ; } else { // Check the parent has the same name if ( comment . getParent ( ) != null ) { if ( comment . getParent ( ) instanceof ContentSpec ) { return node . getParent ( ) == null ; } else if ( comment . getParent ( ) instanceof Level && node . getParent ( ) != null ) { final Level parent = ( ( Level ) comment . getParent ( ) ) ; return parent . getTitle ( ) . equals ( node . getParent ( ) . getTitle ( ) ) ; } else { return false ; } } return true ; } }
Checks to see if a ContentSpec comment matches a Content Spec Entity comment .