3

This is my first time running the debugger to check the values of my binary search tree but it seems to skip through all the debugger and it has a weird arrow beside the blue dot. By the way, the skip all breakpoints is disabled I made sure of it.

This is a short GIF of me running the program https://gyazo.com/e236c1bd75ac746bf9982871ca847233

Added my other class

public class BinaryTree<T extends Comparable<T>> {

private class Node{

    private T data;
    private Node left;
    private Node right;

    // left and right child do not have to nessary exist
    public Node ( T data) {
        this.data = data;
        this.left = null;
        this.right = null; 
    }}

    private Node root;
    private int count = 0;

    public void add( T data) {
        if ( isEmpty()) {
            root = new Node(data);
            count++;
        }
        else {
            insert(data, root);
            count++;
        }
    }

    public boolean isEmpty() {  
        return root == null;
    }

    public T getRoot()  {
        if ( root.data == null) {
            System.out.println("Root is empty");
            return null;
        }
        else {
        return  root.data;
    }}

    /*
     * Checking if the data is larger or lesser than the parent's data
     * If the data is smaller than the parent's data, node.left is created 
     * If the data is bigger than the parent's data, node.right is created
     */
    private void insert( T data, Node node) {

        /*
         * If 1st obj is less than the 2nd obj return a neg
         * if 1st obj is more than the 2nd obj return a pos
         * if equal return 0
         */
        int compare = data.compareTo(node.data);
        if ( compare < 1 ){
            if (node.left == null ) {
                node.left = new Node(data);

            }

        // make node.left if it is filled   
            else {
                insert(data, node.left);
            }
        }

        else {
            if ( node.right == null) {
                node.right = new Node(data);
            }
            else {
                insert( data, node.right);
            }
        }
    }

    public int getSize() {
        return count;
    }

    private void removeInner( T data, Node node ) {

    Node temp;
    while ( node.data!=data) {
        int compare = data.compareTo(node.data);

        if ( compare < 1 ){
            node = node.left;
        }
        // make node.left if it is filled   
        if ( compare > 1 ){
            node = node.right;
            }

        if ( compare == 0) {
            node = null;
        }


        }


    }

}

enter image description here

7
  • Did you launch your application using Debug instead of Run? Commented May 28, 2020 at 13:28
  • @nitind yes, nothing really popped up Commented May 28, 2020 at 13:29
  • Maybe try reinstalling eclipse, not what you want to hear but could be the easiest route in the long run! Commented May 28, 2020 at 13:36
  • Which JRE are you running it with? Is Eclipse compiling the class or an external tool? Can you remove and reset the breakpoint? Commented May 28, 2020 at 13:44
  • @nitind Eclipse IDE for Java Developers Version: 2020-03 (4.15.0) Build id: 20200313-1211 jdk-14.0.1 Not sure what you meant by reset. I can remove it. I'm not exactly sure about the compile question but it should be compiling class. I'm not using any external tools Commented May 28, 2020 at 13:46

1 Answer 1

2

You have one or more so-called Trigger Points (decorated with a T) somewhere else from which one must be hit first to activate the other regular breakpoints. This can be seen by the regular breakpoint in line 9 being decorated with a crossed-out T.

Solution: Delete or deactivate all Trigger Points (those decorated with T), e.g. in the Breakpoints view.

Sign up to request clarification or add additional context in comments.

7 Comments

You mean there is some issue with the other class? That doesn't allow the code to run properly?
The trigger point option in my breakpoint properties is disabled. The only check box ticket is enabled
@Fenzox The breakpoint in line 9 will not become active, because the line where the Trigger Point is (which is in a different file), is not executed.
That function is activated, the size of the binary tree did increase and I'm not getting any errors
@Fenzox The breakpoint in line 9 is a regular breakpoint. But somewhere else (not in the shown file) there are one or more Trigger Points, that have to be deleted, deactivated or turned into regular breakpoints.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.