code: public boolean matches(String string) {
          String src = string;
          final boolean result;
          if (_compiledPattern.length == 1) {
  
              // Shortcut for pattern '*', '?' and patterns not containing any wildcard
              final GlobPattern pattern = _compiledPattern[0];
              if (pattern.getType() == GLOB_MULTIPLE) {
                  result = true;
              } else if (pattern.getType() == GLOB_SINGLE) {
                  result = src.length() == 1;
              } else {
                  if (_caseInSensitive) {
                      result = src.equalsIgnoreCase(pattern.getText());
                  } else {
                      result = src.equals(pattern.getText());
                  }
              }
              
          } else if (_compiledPattern.length == 2) {
  
              // Shortcuts for common patterns '*something' and 'something*'
              final GlobPattern pattern1 = _compiledPattern[0];
              final GlobPattern pattern2 = _compiledPattern[1];
              if (_caseInSensitive) {
                  src = src.toLowerCase();
              }
              if (pattern1.getType() == TEXT) {
                   result = src.startsWith(pattern1.getText()) && (pattern2.getType() == GLOB_MULTIPLE || src.length() == pattern1.getTextLength()+1);
              } else {
                  result = src.endsWith(pattern2.getText()) && (pattern1.getType() == GLOB_MULTIPLE || src.length() == pattern2.getTextLength()+1);
              }
  
          } else {
              result = matches(src.toCharArray());
          }
          return result;
      }
docs: Match the given string.