Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy between the file and the DB #23

Open
T45K opened this issue Sep 28, 2020 · 0 comments
Open

Discrepancy between the file and the DB #23

T45K opened this issue Sep 28, 2020 · 0 comments

Comments

@T45K
Copy link
Contributor

T45K commented Sep 28, 2020

Is there a discrepancy between the contents of bcb_reduced/14/selected/1280123.java and FUNCTIONS table in bcb.h2.db?
For example, record name: 1280123.java, type: selected, startline: 280, endline: 290 seems to point to a code fragment,

519    private final int search(char c, boolean exact) {
520        int low = 0;
521        int high = children.size() - 1;
522        while (low <= high) {
523            int middle = (low + high) / 2;
524            char cmiddle = get(middle).getLabelStart();
525            if (cmiddle < c) low = middle + 1; else if (c < cmiddle) high = middle - 1; else return middle;
526        }
527        if (exact) return -1;
528        return high;
529    }

but it actually points to

275    public Iterator getPrefixedBy(String prefix, int startOffset, int stopOffset) {
276        TrieNode node = root;
277        for (int i = startOffset; i < stopOffset; ) {
278            TrieEdge edge = node.get(prefix.charAt(i));
279            if (edge == null) {
280                return EMPTY_ITERATOR;
281            }
282            node = edge.getChild();
283            String label = edge.getLabel();
284            int j = match(prefix, i, stopOffset, label);
285            if (i + j == stopOffset) {
286                break;
287            } else if (j >= 0) {
288                node = null;
289                break;
290            } else {
291            }
292            i += label.length();
293        }
294        if (node == null) return EMPTY_ITERATOR; else return new ValueIterator(node);
295    }

(Due to this problem, type-1 clone recall of a clone detector I implemented won't reach 1.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant