All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gnu.trove.list.TShortList Maven / Gradle / Ivy

Go to download

The Trove library provides high speed regular and primitive collections for Java.

There is a newer version: 3.0.3
Show newest version
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2009, Rob Eden All Rights Reserved.
// Copyright (c) 2009, Jeff Randall All Rights Reserved.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
///////////////////////////////////////////////////////////////////////////////

package gnu.trove.list;

//////////////////////////////////////////////////
// THIS IS A GENERATED CLASS. DO NOT HAND EDIT! //
//////////////////////////////////////////////////


import gnu.trove.function.*;
import gnu.trove.procedure.*;
import gnu.trove.TShortCollection;

import java.io.Serializable;
import java.util.Random;



/**
 * Interface for Trove list implementations.
 */
public interface TShortList extends TShortCollection {
    /**
     * Returns the value that is used to represent null. The default
     * value is generally zero, but can be changed during construction
     * of the collection.
     *
     * @return the value that represents null
     */
    public short getNoEntryValue();


    /**
     * Returns the number of values in the list.
     *
     * @return the number of values in the list.
     */
    public int size();


    /**
     * Tests whether this list contains any values.
     *
     * @return true if the list is empty.
     */
    public boolean isEmpty();


    /**
     * Adds val to the end of the list, growing as needed.
     *
     * @param val an short value
     * @return true if the list was modified by the add operation 
     */
    public boolean add(short val);


    /**
     * Adds the values in the array vals to the end of the
     * list, in order.
     *
     * @param vals an short[] value
     */
    public void add( short[] vals );


    /**
     * Adds a subset of the values in the array vals to the
     * end of the list, in order.
     *
     * @param vals an short[] value
     * @param offset the offset at which to start copying
     * @param length the number of values to copy.
     */
    public void add( short[] vals, int offset, int length );


   /**
     * Inserts value into the list at offset.  All
     * values including and to the right of offset are shifted
     * to the right.
     *
     * @param offset an int value
     * @param value an short value
     */
    public void insert( int offset, short value );


    /**
     * Inserts the array of values into the list at
     * offset.  All values including and to the right of
     * offset are shifted to the right.
     *
     * @param offset an int value
     * @param values an short[] value
     */
    public void insert( int offset, short[] values );


    /**
     * Inserts a slice of the array of values into the list
     * at offset.  All values including and to the right of
     * offset are shifted to the right.
     *
     * @param offset an int value
     * @param values an short[] value
     * @param valOffset the offset in the values array at which to
     * start copying.
     * @param len the number of values to copy from the values array
     */
    public void insert( int offset, short[] values, int valOffset, int len );


    /**
     * Returns the value at the specified offset.
     *
     * @param offset an int value
     * @return an short value
     */
    public short get( int offset );


    /**
     * Sets the value at the specified offset.
     *
     * @param offset an int value
     * @param val an short value
	 *
	 * @return	The value previously at the given index.
     */
    public short set( int offset, short val );


    /**
     * Replace the values in the list starting at offset with
     * the contents of the values array.
     *
     * @param offset the first offset to replace
     * @param values the source of the new values
     */
    public void set( int offset, short[] values );


    /**
     * Replace the values in the list starting at offset with
     * length values from the values array, starting
     * at valOffset.
     *
     * @param offset the first offset to replace
     * @param values the source of the new values
     * @param valOffset the first value to copy from the values array
     * @param length the number of values to copy
     */
    public void set( int offset, short[] values, int valOffset, int length );


    /**
     * Sets the value at the specified offset and returns the
     * previously stored value.
     *
     * @param offset an int value
     * @param val an short value
     * @return the value previously stored at offset.
     */
    public short replace( int offset, short val );


    /**
     * Flushes the internal state of the list, resetting the capacity
     * to the default.
     */
    public void clear();


    /**
     * Removes value from the list.
     *
     * @param value an short value
     * @return true if the list was modified by the remove operation.
     */
    public boolean remove( short value );


    /**
     * Removes value at a given offset from the list.
     *
     * @param offset an int value that represents
     *               the offset to the element to be removed
     * @return an short that is the value removed.
     */
    public short removeAt( int offset );


    /**
     * Removes length values from the list, starting at
     * offset
     *
     * @param offset an int value
     * @param length an int value
     */
    public void remove( int offset, int length );


    /**
     * Transform each value in the list using the specified function.
     *
     * @param function a TShortFunction value
     */
    public void transformValues( TShortFunction function );


    /**
     * Reverse the order of the elements in the list.
     */
    public void reverse();


    /**
     * Reverse the order of the elements in the range of the list.
     *
     * @param from the inclusive index at which to start reversing
     * @param to the exclusive index at which to stop reversing
     */
    public void reverse( int from, int to );


    /**
     * Shuffle the elements of the list using the specified random
     * number generator.
     *
     * @param rand a Random value
     */
    public void shuffle( Random rand );


    /**
     * Returns a sublist of this list.
     *
     * @param begin low endpoint (inclusive) of the subList.
     * @param end high endpoint (exclusive) of the subList.
     * @return sublist of this list from begin, inclusive to end, exclusive.
     * @throws IndexOutOfBoundsException - endpoint out of range
     * @throws IllegalArgumentException - endpoints out of order (end > begin)
     */
    public TShortList subList( int begin, int end );


    /**
     * Copies the contents of the list into a native array.
     *
     * @return an short[] value
     */
    public short[] toArray();


    /**
     * Copies a slice of the list into a native array.
     *
     * @param offset the offset at which to start copying
     * @param len the number of values to copy.
     * @return an short[] value
     */
    public short[] toArray( int offset, int len );


    /**
     * Copies a slice of the list into a native array.
     *
     * 

If the list fits in the specified array with room to spare (i.e., * the array has more elements than the list), the element in the array * immediately following the end of the list is set to * {@link #getNoEntryValue()}. * (This is useful in determining the length of the list only if * the caller knows that the list does not contain any "null" elements.) * *

NOTE: Trove does not allocate a new array if the array passed in is * not large enough to hold all of the data elements. It will instead fill * the array passed in. * * @param dest the array to copy into. * @return the array passed in. */ public short[] toArray( short[] dest ); /** * Copies a slice of the list into a native array. * * @param dest the array to copy into. * @param offset the offset where the first value should be copied * @param len the number of values to copy. * @return the array passed in. */ public short[] toArray( short[] dest, int offset, int len ); /** * Copies a slice of the list into a native array. * * @param dest the array to copy into. * @param source_pos the offset of the first value to copy * @param dest_pos the offset where the first value should be copied * @param len the number of values to copy. * @return the array passed in. */ public short[] toArray( short[] dest, int source_pos, int dest_pos, int len ); /** * Applies the procedure to each value in the list in ascending * (front to back) order. * * @param procedure a TShortProcedure value * @return true if the procedure did not terminate prematurely. */ public boolean forEach( TShortProcedure procedure ); /** * Applies the procedure to each value in the list in descending * (back to front) order. * * @param procedure a TShortProcedure value * @return true if the procedure did not terminate prematurely. */ public boolean forEachDescending( TShortProcedure procedure ); /** * Sort the values in the list (ascending) using the Sun quicksort * implementation. * * @see java.util.Arrays#sort */ public void sort(); /** * Sort a slice of the list (ascending) using the Sun quicksort * implementation. * * @param fromIndex the index at which to start sorting (inclusive) * @param toIndex the index at which to stop sorting (exclusive) * @see java.util.Arrays#sort */ public void sort( int fromIndex, int toIndex ); /** * Fills every slot in the list with the specified value. * * @param val the value to use when filling */ public void fill( short val ); /** * Fills a range in the list with the specified value. * * @param fromIndex the offset at which to start filling (inclusive) * @param toIndex the offset at which to stop filling (exclusive) * @param val the value to use when filling */ public void fill( int fromIndex, int toIndex, short val ); /** * Performs a binary search for value in the entire list. * Note that you must @{link #sort sort} the list before * doing a search. * * @param value the value to search for * @return the absolute offset in the list of the value, or its * negative insertion point into the sorted list. */ public int binarySearch( short value ); /** * Performs a binary search for value in the specified * range. Note that you must @{link #sort sort} the list * or the range before doing a search. * * @param value the value to search for * @param fromIndex the lower boundary of the range (inclusive) * @param toIndex the upper boundary of the range (exclusive) * @return the absolute offset in the list of the value, or its * negative insertion point into the sorted list. */ public int binarySearch( short value, int fromIndex, int toIndex ); /** * Searches the list front to back for the index of * value. * * @param value an short value * @return the first offset of the value, or -1 if it is not in * the list. * @see #binarySearch for faster searches on sorted lists */ public int indexOf( short value ); /** * Searches the list front to back for the index of * value, starting at offset. * * @param offset the offset at which to start the linear search * (inclusive) * @param value an short value * @return the first offset of the value, or -1 if it is not in * the list. * @see #binarySearch for faster searches on sorted lists */ public int indexOf( int offset, short value ); /** * Searches the list back to front for the last index of * value. * * @param value an short value * @return the last offset of the value, or -1 if it is not in * the list. * @see #binarySearch for faster searches on sorted lists */ public int lastIndexOf( short value ); /** * Searches the list back to front for the last index of * value, starting at offset. * * @param offset the offset at which to start the linear search * (exclusive) * @param value an short value * @return the last offset of the value, or -1 if it is not in * the list. * @see #binarySearch for faster searches on sorted lists */ public int lastIndexOf( int offset, short value ); /** * Searches the list for value * * @param value an short value * @return true if value is in the list. */ public boolean contains( short value ); /** * Searches the list for values satisfying condition in * the manner of the *nix grep utility. * * @param condition a condition to apply to each element in the list * @return a list of values which match the condition. */ public TShortList grep( TShortProcedure condition ); /** * Searches the list for values which do not satisfy * condition. This is akin to *nix grep -v. * * @param condition a condition to apply to each element in the list * @return a list of values which do not match the condition. */ public TShortList inverseGrep( TShortProcedure condition ); /** * Finds the maximum value in the list. * * @return the largest value in the list. * @exception IllegalStateException if the list is empty */ public short max(); /** * Finds the minimum value in the list. * * @return the smallest value in the list. * @exception IllegalStateException if the list is empty */ public short min(); /** * Calculates the sum of all the values in the list. * * @return the sum of the values in the list (zero if the list is empty). */ public short sum(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy