/** * Searches the receiver for the specified value using the binary search algorithm. The receiver must * <strong>must</strong> be sorted (as by the sort method) prior to making this call. If it is not sorted, the * results are undefined: in particular, the call may enter an infinite loop. If the receiver contains multiple * elements equal to the specified object, there is no guarantee which instance will be found. * * @param key the value to be searched for. * @param from the leftmost search position, inclusive. * @param to the rightmost search position, inclusive. * @return index of the search key, if it is contained in the receiver; otherwise, <tt>(-(<i>insertion point</i>) - * 1)</tt>. The <i>insertion point</i> is defined as the the point at which the value would be inserted into * the receiver: the index of the first element greater than the key, or <tt>receiver.size()</tt>, if all * elements in the receiver are less than the specified key. Note that this guarantees that the return value * will be >= 0 if and only if the key is found. * @see org.apache.mahout.math.Sorting * @see java.util.Arrays */ @Override public int binarySearchFromTo(short key, int from, int to) { return org.apache.mahout.math.Sorting.binarySearchFromTo(elements, key, from, to); }
/** * Searches the receiver for the specified value using the binary search algorithm. The receiver must * <strong>must</strong> be sorted (as by the sort method) prior to making this call. If it is not sorted, the * results are undefined: in particular, the call may enter an infinite loop. If the receiver contains multiple * elements equal to the specified object, there is no guarantee which instance will be found. * * @param key the value to be searched for. * @param from the leftmost search position, inclusive. * @param to the rightmost search position, inclusive. * @return index of the search key, if it is contained in the receiver; otherwise, <tt>(-(<i>insertion point</i>) - * 1)</tt>. The <i>insertion point</i> is defined as the the point at which the value would be inserted into * the receiver: the index of the first element greater than the key, or <tt>receiver.size()</tt>, if all * elements in the receiver are less than the specified key. Note that this guarantees that the return value * will be >= 0 if and only if the key is found. * @see org.apache.mahout.math.Sorting * @see java.util.Arrays */ @Override public int binarySearchFromTo(double key, int from, int to) { return org.apache.mahout.math.Sorting.binarySearchFromTo(elements, key, from, to); }
/** * Searches the receiver for the specified value using the binary search algorithm. The receiver must * <strong>must</strong> be sorted (as by the sort method) prior to making this call. If it is not sorted, the * results are undefined: in particular, the call may enter an infinite loop. If the receiver contains multiple * elements equal to the specified object, there is no guarantee which instance will be found. * * @param key the value to be searched for. * @param from the leftmost search position, inclusive. * @param to the rightmost search position, inclusive. * @return index of the search key, if it is contained in the receiver; otherwise, <tt>(-(<i>insertion point</i>) - * 1)</tt>. The <i>insertion point</i> is defined as the the point at which the value would be inserted into * the receiver: the index of the first element greater than the key, or <tt>receiver.size()</tt>, if all * elements in the receiver are less than the specified key. Note that this guarantees that the return value * will be >= 0 if and only if the key is found. * @see org.apache.mahout.math.Sorting * @see java.util.Arrays */ @Override public int binarySearchFromTo(float key, int from, int to) { return org.apache.mahout.math.Sorting.binarySearchFromTo(elements, key, from, to); }
/** * Searches the receiver for the specified value using the binary search algorithm. The receiver must * <strong>must</strong> be sorted (as by the sort method) prior to making this call. If it is not sorted, the * results are undefined: in particular, the call may enter an infinite loop. If the receiver contains multiple * elements equal to the specified object, there is no guarantee which instance will be found. * * @param key the value to be searched for. * @param from the leftmost search position, inclusive. * @param to the rightmost search position, inclusive. * @return index of the search key, if it is contained in the receiver; otherwise, <tt>(-(<i>insertion point</i>) - * 1)</tt>. The <i>insertion point</i> is defined as the the point at which the value would be inserted into * the receiver: the index of the first element greater than the key, or <tt>receiver.size()</tt>, if all * elements in the receiver are less than the specified key. Note that this guarantees that the return value * will be >= 0 if and only if the key is found. * @see org.apache.mahout.math.Sorting * @see java.util.Arrays */ @Override public int binarySearchFromTo(byte key, int from, int to) { return org.apache.mahout.math.Sorting.binarySearchFromTo(elements, key, from, to); }
/** * Searches the receiver for the specified value using the binary search algorithm. The receiver must * <strong>must</strong> be sorted (as by the sort method) prior to making this call. If it is not sorted, the * results are undefined: in particular, the call may enter an infinite loop. If the receiver contains multiple * elements equal to the specified object, there is no guarantee which instance will be found. * * @param key the value to be searched for. * @param from the leftmost search position, inclusive. * @param to the rightmost search position, inclusive. * @return index of the search key, if it is contained in the receiver; otherwise, <tt>(-(<i>insertion point</i>) - * 1)</tt>. The <i>insertion point</i> is defined as the the point at which the value would be inserted into * the receiver: the index of the first element greater than the key, or <tt>receiver.size()</tt>, if all * elements in the receiver are less than the specified key. Note that this guarantees that the return value * will be >= 0 if and only if the key is found. * @see org.apache.mahout.math.Sorting * @see java.util.Arrays */ @Override public int binarySearchFromTo(long key, int from, int to) { return org.apache.mahout.math.Sorting.binarySearchFromTo(elements, key, from, to); }
/** * Searches the receiver for the specified value using the binary search algorithm. The receiver must * <strong>must</strong> be sorted (as by the sort method) prior to making this call. If it is not sorted, the * results are undefined: in particular, the call may enter an infinite loop. If the receiver contains multiple * elements equal to the specified object, there is no guarantee which instance will be found. * * @param key the value to be searched for. * @param from the leftmost search position, inclusive. * @param to the rightmost search position, inclusive. * @return index of the search key, if it is contained in the receiver; otherwise, <tt>(-(<i>insertion point</i>) - * 1)</tt>. The <i>insertion point</i> is defined as the the point at which the value would be inserted into * the receiver: the index of the first element greater than the key, or <tt>receiver.size()</tt>, if all * elements in the receiver are less than the specified key. Note that this guarantees that the return value * will be >= 0 if and only if the key is found. * @see org.apache.mahout.math.Sorting * @see java.util.Arrays */ @Override public int binarySearchFromTo(int key, int from, int to) { return org.apache.mahout.math.Sorting.binarySearchFromTo(elements, key, from, to); }
/** * Searches the receiver for the specified value using the binary search algorithm. The receiver must * <strong>must</strong> be sorted (as by the sort method) prior to making this call. If it is not sorted, the * results are undefined: in particular, the call may enter an infinite loop. If the receiver contains multiple * elements equal to the specified object, there is no guarantee which instance will be found. * * @param key the value to be searched for. * @param from the leftmost search position, inclusive. * @param to the rightmost search position, inclusive. * @return index of the search key, if it is contained in the receiver; otherwise, <tt>(-(<i>insertion point</i>) - * 1)</tt>. The <i>insertion point</i> is defined as the the point at which the value would be inserted into * the receiver: the index of the first element greater than the key, or <tt>receiver.size()</tt>, if all * elements in the receiver are less than the specified key. Note that this guarantees that the return value * will be >= 0 if and only if the key is found. * @see org.apache.mahout.math.Sorting * @see java.util.Arrays */ @Override public int binarySearchFromTo(char key, int from, int to) { return org.apache.mahout.math.Sorting.binarySearchFromTo(elements, key, from, to); }