The Octet Molecular Representation Framework v0.8.2

net.sf.octet.util
Class ArrayKit

java.lang.Object
  extended bynet.sf.octet.util.ArrayKit

public class ArrayKit
extends java.lang.Object

A collection of static utility methods for working with arrays.

Author:
Richard Apodaca

Method Summary
static boolean containsDuplicates(java.lang.Object[] array)
          Returns true if array contains any duplicate elements, or false otherwise.
static int countMatches(java.lang.Object[] array, java.lang.Object search)
          Counts the number of occurrances of search in array.
static int countMatches(java.lang.Object[] array, java.lang.Object[] search)
          Returns the number of common Objects in array and search.
static int indexOf(java.lang.Object[] array, java.lang.Object search)
          Performs a linear search for search within array, returning the index if found, or -1 otherwise.
static boolean match(java.lang.Object[] array, java.lang.Object search)
          Returns true if search is contained within array, or false otherwise.
static boolean matchAll(java.lang.Object[] array, java.lang.Object[] search)
          Returns true the elements of array and search are identical.
static boolean matchInOrder(java.lang.Object[] array, java.lang.Object[] search)
          Returns true the elements and ordering of array and search are identical.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

countMatches

public static int countMatches(java.lang.Object[] array,
                               java.lang.Object[] search)
Returns the number of common Objects in array and search.

Parameters:
array - the array
search - the search
Returns:
the number of common Objects in array and search

countMatches

public static int countMatches(java.lang.Object[] array,
                               java.lang.Object search)
Counts the number of occurrances of search in array.

Parameters:
array - the array to check
search - the object to search for
Returns:
the number of occurrances of search in array

indexOf

public static int indexOf(java.lang.Object[] array,
                          java.lang.Object search)
Performs a linear search for search within array, returning the index if found, or -1 otherwise.

Parameters:
array - the array to search
search - the object to find
Returns:
the index, or -1 if not found

match

public static boolean match(java.lang.Object[] array,
                            java.lang.Object search)
Returns true if search is contained within array, or false otherwise.

Parameters:
array - the array to search
search - the object to find
Returns:
true if found, false otherwise

matchInOrder

public static boolean matchInOrder(java.lang.Object[] array,
                                   java.lang.Object[] search)
Returns true the elements and ordering of array and search are identical.

Parameters:
array - the array to be searched
search - the array containing the elements to search for
Returns:
true if both arrays contain the same elements in the same relative ordering, or false otherwise

matchAll

public static boolean matchAll(java.lang.Object[] array,
                               java.lang.Object[] search)
Returns true the elements of array and search are identical. The relative ordering may vary.

Parameters:
array - the array to be searched
search - the array containing the elements to search for
Returns:
true if both arrays contain the same elements in any relative ordering, or false otherwise

containsDuplicates

public static boolean containsDuplicates(java.lang.Object[] array)
Returns true if array contains any duplicate elements, or false otherwise.

Parameters:
array - the array to be searched
Returns:
true if array contains any duplicate elements, or false otherwise

The Octet Molecular Representation Framework v0.8.2