private boolean matches(String selector,String name){
  if (selector.equals("*")) {
    return true;
  }
  if (selector.endsWith(".*")) {
    return name.startsWith(selector.substring(0,selector.length() - 1));
  }
  return name.equals(selector);
}

private boolean matches ( String selector , String name ) { if ( selector . equals ( "*" ) ) { return true ; } if ( selector . endsWith ( ".*" ) ) { return name . startsWith ( selector . substring ( 0 , selector . length ( ) - 1 ) ) ; } return name . equals ( selector ) ; }
check whether a name matches selector .
