/** * do the actual lookup of a piece of data * * @param data the key or value to be looked up * @param index KEY or VALUE * * @return the desired Node, or null if there is no mapping of the * specified data */ private Node lookup(final Comparable data, final int index) { Node rval = null; Node node = rootNode[index]; while (node != null) { int cmp = compare(data, node.getData(index)); if (cmp == 0) { rval = node; break; } else { node = (cmp < 0) ? node.getLeft(index) : node.getRight(index); } } return rval; }
/** * do the actual lookup of a piece of data * * @param data the key or value to be looked up * @param index KEY or VALUE * * @return the desired Node, or null if there is no mapping of the * specified data */ private Node lookup(final Comparable data, final int index) { Node rval = null; Node node = rootNode[index]; while (node != null) { int cmp = compare(data, node.getData(index)); if (cmp == 0) { rval = node; break; } else { node = (cmp < 0) ? node.getLeft(index) : node.getRight(index); } } return rval; }
int cmp = compare(newNode.getData(VALUE), node.getData(VALUE));
int cmp = compare(newNode.getData(VALUE), node.getData(VALUE));
} else { while (true) { int cmp = compare((Comparable) key, node.getData(KEY));
} else { while (true) { int cmp = compare((Comparable) key, node.getData(KEY));
/** * do the actual lookup of a piece of data * * @param data the key or value to be looked up * @param index KEY or VALUE * * @return the desired Node, or null if there is no mapping of the * specified data */ private Node lookup(final Comparable data, final int index) { Node rval = null; Node node = rootNode[index]; while (node != null) { int cmp = compare(data, node.getData(index)); if (cmp == 0) { rval = node; break; } else { node = (cmp < 0) ? node.getLeft(index) : node.getRight(index); } } return rval; }
/** * do the actual lookup of a piece of data * * @param data the key or value to be looked up * @param index KEY or VALUE * * @return the desired Node, or null if there is no mapping of the * specified data */ private Node lookup(final Comparable data, final int index) { Node rval = null; Node node = rootNode[index]; while (node != null) { int cmp = compare(data, node.getData(index)); if (cmp == 0) { rval = node; break; } else { node = (cmp < 0) ? node.getLeft(index) : node.getRight(index); } } return rval; }
/** * do the actual lookup of a piece of data * * @param data the key or value to be looked up * @param index KEY or VALUE * * @return the desired Node, or null if there is no mapping of the * specified data */ private Node lookup(final Comparable data, final int index) { Node rval = null; Node node = rootNode[index]; while (node != null) { int cmp = compare(data, node.getData(index)); if (cmp == 0) { rval = node; break; } else { node = (cmp < 0) ? node.getLeft(index) : node.getRight(index); } } return rval; }
/** * do the actual lookup of a piece of data * * @param data the key or value to be looked up * @param index KEY or VALUE * * @return the desired Node, or null if there is no mapping of the * specified data */ private Node lookup(final Comparable data, final int index) { Node rval = null; Node node = rootNode[index]; while (node != null) { int cmp = compare(data, node.getData(index)); if (cmp == 0) { rval = node; break; } else { node = (cmp < 0) ? node.getLeft(index) : node.getRight(index); } } return rval; }
/** * do the actual lookup of a piece of data * * @param data the key or value to be looked up * @param index KEY or VALUE * * @return the desired Node, or null if there is no mapping of the * specified data */ private Node lookup(final Comparable data, final int index) { Node rval = null; Node node = rootNode[index]; while (node != null) { int cmp = compare(data, node.getData(index)); if (cmp == 0) { rval = node; break; } else { node = (cmp < 0) ? node.getLeft(index) : node.getRight(index); } } return rval; }
int cmp = compare(newNode.getData(VALUE), node.getData(VALUE));
int cmp = compare(newNode.getData(VALUE), node.getData(VALUE));
int cmp = compare(newNode.getData(VALUE), node.getData(VALUE));
int cmp = compare(newNode.getData(VALUE), node.getData(VALUE));
int cmp = compare(newNode.getData(VALUE), node.getData(VALUE));
} else { while (true) { int cmp = compare((Comparable) key, node.getData(KEY));
} else { while (true) { int cmp = compare((Comparable) key, node.getData(KEY));
} else { while (true) { int cmp = compare((Comparable) key, node.getData(KEY));
} else { while (true) { int cmp = compare((Comparable) key, node.getData(KEY));