def generate_candidates(self, api_name, context): candidate_set = CandidateSet() self.add_candidate_by_alias_exactly_match(api_name, candidate_set) # the extractly match api by alias is impossible, more way need to be done if candidate_set.size() == 0: simple_name = AliasUtil.get_simple_name_from_qualifier_name( api_name) self.add_candidate_by_alias_exactly_match(simple_name, candidate_set) return candidate_set
def get_parameter_similarity_from_declaration(self, api_entity, context): if not context: return 0 declaration = None if "declaration" in context: declaration = context["declaration"] # not valid api type if not declaration or declaration == "null": return 0 main_declaration = AliasUtil.get_main_declaration_string(declaration) declaration_similarity = self.get_parameter_similarity( api_entity, main_declaration) return declaration_similarity
def is_usable(self, start_api_name, context): declaration = None if not context: return False if "declaration" in context: declaration = context["declaration"] # not valid api type if not declaration or declaration == "null": return False main_declaration_string = AliasUtil.get_main_declaration_string( declaration) if not main_declaration_string: return False return True
def prepare_global_info(self, start_api_name, context): declaration = context["declaration"] main_declaration_string = AliasUtil.get_main_declaration_string( declaration) return {"main_declaration_string": main_declaration_string}