Example #1
0
    def _link_enumerations(self, enum_refs, ecount, progress_monitor):
        count = 0
        progress_monitor.start('Parsing enumerations', ecount)
        log = gl.LinkerLog(self, self.enum_kind.kind)

        for scode_reference in enum_refs:
            if scode_reference.declaration:
                progress_monitor.work('Skipped declaration', 1)
                continue

            (simple, fqn) = je.get_annotation_name(scode_reference.content,
                    scode_reference.snippet is not None)

            if simple is not None:
                prefix = '{0}{1}{2}'.format(PREFIX_ENUMERATION_LINKER, EXACT,
                    cu.get_codebase_key(self.codebase))
                code_elements = cu.get_value(
                        prefix,
                        simple,
                        gl.get_type_code_elements,
                        [simple, self.codebase, self.enum_kind])

                (code_element, potentials) = self.get_code_element(
                        scode_reference, code_elements, simple, fqn, log)
                count += gl.save_link(scode_reference, code_element,
                        potentials, self)

                if not log.custom_filtered:
                    reclassify_java(code_element, scode_reference)

            progress_monitor.work('Processed enumeration', 1)

        log.close()
        progress_monitor.done()
        print('Associated {0} enumerations'.format(count))
Example #2
0
    def _link_enumerations(self, enum_refs, ecount, progress_monitor):
        count = 0
        progress_monitor.start('Parsing enumerations', ecount)
        log = gl.LinkerLog(self, self.enum_kind.kind)

        for scode_reference in enum_refs:
            if scode_reference.declaration:
                progress_monitor.work('Skipped declaration', 1)
                continue

            (simple,
             fqn) = je.get_annotation_name(scode_reference.content,
                                           scode_reference.snippet is not None)

            if simple is not None:
                prefix = '{0}{1}{2}'.format(PREFIX_ENUMERATION_LINKER, EXACT,
                                            cu.get_codebase_key(self.codebase))
                code_elements = cu.get_value(
                    prefix, simple, gl.get_type_code_elements,
                    [simple, self.codebase, self.enum_kind])

                (code_element,
                 potentials) = self.get_code_element(scode_reference,
                                                     code_elements, simple,
                                                     fqn, log)
                count += gl.save_link(scode_reference, code_element,
                                      potentials, self)

                if not log.custom_filtered:
                    reclassify_java(code_element, scode_reference)

            progress_monitor.work('Processed enumeration', 1)

        log.close()
        progress_monitor.done()
        print('Associated {0} enumerations'.format(count))
Example #3
0
    def _link_classes(self, class_refs, ccount, progress_monitor):
        count = 0
        progress_monitor.start('Parsing classes', ccount)
        log = gl.LinkerLog(self, self.class_kind.kind)

        for scode_reference in class_refs:
            if scode_reference.declaration:
                progress_monitor.work('Skipped declaration', 1)
                continue

            (simple,
             fqn) = je.get_annotation_name(scode_reference.content,
                                           scode_reference.snippet is not None)
            case_insensitive = scode_reference.snippet == None and\
                    self.source != 'd'

            if case_insensitive:
                exact = False
                exact_prefix = IEXACT
            else:
                exact = True
                exact_prefix = EXACT

            if simple is not None:
                prefix = '{0}{1}{2}'.format(PREFIX_CLASS_LINKER, exact_prefix,
                                            cu.get_codebase_key(self.codebase))
                code_elements = []
                code_elements.extend(
                    cu.get_value(
                        prefix, simple, gl.get_type_code_elements,
                        [simple, self.codebase, self.class_kind, exact]))

                prefix = '{0}{1}{2}'.format(PREFIX_ANNOTATION_LINKER,
                                            exact_prefix,
                                            cu.get_codebase_key(self.codebase))
                code_elements.extend(
                    cu.get_value(
                        prefix, simple, gl.get_type_code_elements,
                        [simple, self.codebase, self.ann_kind, exact]))

                prefix = '{0}{1}{2}'.format(PREFIX_ENUMERATION_LINKER,
                                            exact_prefix,
                                            cu.get_codebase_key(self.codebase))
                code_elements.extend(
                    cu.get_value(
                        prefix, simple, gl.get_type_code_elements,
                        [simple, self.codebase, self.enum_kind, exact]))

                (code_element,
                 potentials) = self.get_code_element(scode_reference,
                                                     code_elements, simple,
                                                     fqn, log, not exact)
                count += gl.save_link(scode_reference, code_element,
                                      potentials, self)

                if not log.custom_filtered:
                    reclassify_java(code_element, scode_reference)

            progress_monitor.work('Processed class', 1)

        log.close()
        progress_monitor.done()
        print('Associated {0} classes'.format(count))
Example #4
0
    def _link_classes(self, class_refs, ccount, progress_monitor):
        count = 0
        progress_monitor.start('Parsing classes', ccount)
        log = gl.LinkerLog(self, self.class_kind.kind)

        for scode_reference in class_refs:
            if scode_reference.declaration:
                progress_monitor.work('Skipped declaration', 1)
                continue

            (simple, fqn) = je.get_annotation_name(scode_reference.content,
                    scode_reference.snippet is not None)
            case_insensitive = scode_reference.snippet == None and\
                    self.source != 'd'

            if case_insensitive:
                exact = False
                exact_prefix = IEXACT
            else:
                exact = True
                exact_prefix = EXACT

            if simple is not None:
                prefix = '{0}{1}{2}'.format(PREFIX_CLASS_LINKER, exact_prefix,
                    cu.get_codebase_key(self.codebase))
                code_elements = []
                code_elements.extend(cu.get_value(
                        prefix,
                        simple,
                        gl.get_type_code_elements,
                        [simple, self.codebase, self.class_kind, exact]))

                prefix = '{0}{1}{2}'.format(PREFIX_ANNOTATION_LINKER,
                        exact_prefix, cu.get_codebase_key(self.codebase))
                code_elements.extend(cu.get_value(
                        prefix,
                        simple,
                        gl.get_type_code_elements,
                        [simple, self.codebase, self.ann_kind, exact]))

                prefix = '{0}{1}{2}'.format(PREFIX_ENUMERATION_LINKER,
                        exact_prefix, cu.get_codebase_key(self.codebase))
                code_elements.extend(cu.get_value(
                        prefix,
                        simple,
                        gl.get_type_code_elements,
                        [simple, self.codebase, self.enum_kind, exact]))

                (code_element, potentials) = self.get_code_element(
                        scode_reference, code_elements, simple, fqn, log,
                        not exact)
                count += gl.save_link(scode_reference, code_element,
                        potentials, self)

                if not log.custom_filtered:
                    reclassify_java(code_element, scode_reference)

            progress_monitor.work('Processed class', 1)

        log.close()
        progress_monitor.done()
        print('Associated {0} classes'.format(count))