|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hsqldb.lib.ArrayUtil
Collection of static methods for operations on arrays
Field Summary | |
static int |
CLASS_CODE_BOOLEAN
|
static int |
CLASS_CODE_BYTE
|
static int |
CLASS_CODE_CHAR
|
static int |
CLASS_CODE_DOUBLE
|
static int |
CLASS_CODE_FLOAT
|
static int |
CLASS_CODE_INT
|
static int |
CLASS_CODE_LONG
|
static int |
CLASS_CODE_OBJECT
|
static int |
CLASS_CODE_SHORT
|
Constructor Summary | |
ArrayUtil()
|
Method Summary | |
static void |
adjustArray(int type,
Object array,
int usedElements,
int index,
int count)
Handles both addition and removal of rows |
static boolean |
areEqual(int[] arra,
int[] arrb,
int count,
boolean full)
For full == true returns true if arra and arrb are identical (have the same length and contain the same integers in the same sequence). |
static boolean |
areEqualSets(int[] arra,
int[] arrb)
Returns true if a and be contain the same set of integers, not necessarily in the same order. |
static int[] |
arraySlice(int[] source,
int start,
int count)
Returns a range of elements of source from start to end of the array. |
static void |
clearArray(int type,
Object data,
int from,
int to)
|
static int[] |
commonElements(int[] arra,
int[] arrb)
Returns an int[] containing elements shared between the two arrays arra and arrb. |
static boolean |
containsAllTrueElements(boolean[] arra,
boolean[] arrb)
Return true if for each true element in arrb, the corresponding element in arra is true |
static boolean |
containsAt(byte[] arra,
int start,
byte[] arrb)
Returns true if arra from position start contains all elements of arrb in sequential order. |
static void |
copyAdjustArray(Object[] source,
Object[] dest,
Object addition,
int colindex,
int adjust)
Copies elements of source to dest. |
static void |
copyArray(Object source,
Object dest,
int count)
Convenience wrapper for System.arraycopy() |
static void |
copyColumnValues(Object[] row,
int[] colindex,
Object[] colobject)
Copies some elements of row into colobject by using colindex as the list of indexes into row. colindex and colobject are of equal length and normally shorter than row; |
static int |
countCommonElements(int[] arra,
int[] arrb)
Returns the number of elements shared between the two arrays containing sets. |
static int |
countNonStartElementsAt(byte[] arra,
int start,
byte[] arrb)
Returns the count of elements in arra from position start that are not among the the elements of arrb. |
static int |
countSameElements(byte[] arra,
int start,
byte[] arrb)
Returns the count of elements in arra from position start that are sequentially equal to the elements of arrb. |
static int |
countStartElementsAt(byte[] arra,
int start,
byte[] arrb)
Returns the count of elements in arra from position start that are among the elements of arrb. |
static Object |
duplicateArray(Object source)
Returns a duplicates of an array. |
static void |
fillArray(Object[] array,
Object value)
Fills the array with a value |
static int |
find(byte[] arra,
int start,
int limit,
byte[] arrb)
Returns the index of arrb in arra. |
static int |
find(byte[] arra,
int start,
int limit,
int b,
int c)
Returns the index of b or c in arra. |
static int |
find(int[] array,
int value)
Basic find for small arrays. |
static int |
find(Object[] array,
Object object)
Basic find for small arrays. |
static int |
findIn(byte[] arra,
int start,
int limit,
byte[] charset)
Returns an index into arra (or -1) where the character is in the charset byte array. |
static int |
findNot(int[] array,
int value)
Basic find for small arrays. |
static int |
findNotIn(byte[] arra,
int start,
int limit,
byte[] charset)
Returns an index into arra (or -1) where the character is not in the charset byte array. |
static int |
getClassCode(Class cla)
|
static boolean |
haveCommonElement(int[] arra,
int[] arrb,
int bcount)
Returns true if a and the first bcount elements of arrb share any element. |
static boolean |
haveEqualArrays(int[] arra,
int[] arrb,
int count)
Returns true if the first count elements of arra and arrb are identical subarrays of integers |
static boolean |
haveEqualArrays(Object[] arra,
Object[] arrb,
int count)
Returns true if the first count elements of arra and arrb are identical subarrays of Objects |
static boolean |
haveEqualSets(int[] arra,
int[] arrb,
int count)
Returns true if the first count elements of arra and arrb are identical sets of integers (not necessarily in the same order). |
static void |
intIndexesToBooleanArray(int[] arra,
boolean[] arrb)
Set elements of arrb true if their indexes appear in arrb. |
static Object |
resizeArray(Object source,
int newsize)
Returns a new array of given size, containing as many elements of the original array as it can hold. |
static void |
sortArray(int[] array)
Basic sort for small arrays. |
static int[] |
toAdjustedColumnArray(int[] colarr,
int colindex,
int adjust)
Returns a new array with the elements in collar adjusted to reflect changes at colindex. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int CLASS_CODE_BYTE
public static final int CLASS_CODE_CHAR
public static final int CLASS_CODE_DOUBLE
public static final int CLASS_CODE_FLOAT
public static final int CLASS_CODE_INT
public static final int CLASS_CODE_LONG
public static final int CLASS_CODE_OBJECT
public static final int CLASS_CODE_SHORT
public static final int CLASS_CODE_BOOLEAN
Constructor Detail |
public ArrayUtil()
Method Detail |
public static int getClassCode(Class cla)
public static void clearArray(int type, Object data, int from, int to)
public static void adjustArray(int type, Object array, int usedElements, int index, int count)
public static void sortArray(int[] array)
public static int find(Object[] array, Object object)
public static int find(int[] array, int value)
public static int findNot(int[] array, int value)
public static boolean areEqualSets(int[] arra, int[] arrb)
public static boolean areEqual(int[] arra, int[] arrb, int count, boolean full)
public static boolean haveEqualSets(int[] arra, int[] arrb, int count)
public static boolean haveEqualArrays(int[] arra, int[] arrb, int count)
public static boolean haveEqualArrays(Object[] arra, Object[] arrb, int count)
public static boolean haveCommonElement(int[] arra, int[] arrb, int bcount)
public static int[] commonElements(int[] arra, int[] arrb)
e.g.
The arrays
int []arra = {2,11,5,8}
int []arrb = {20,8,10,11,28,12}
will result in:
int []arrc = {11,8}
- Parameters:
arra
- int[]; first column indexesarrb
- int[]; second column indexes
- Returns:
- int[] common indexes or
null
if there is no overlap.
public static int countCommonElements(int[] arra, int[] arrb)
Return the number of elements shared by two column index arrays. This method assumes that each of these arrays contains a set (each element index is listed only once in each index array). Otherwise the returned number will NOT represent the number of unique column indexes shared by both index array.
arra
- int[]; first array of column indexes.arrb
- int[]; second array of column indexes
a
and b
public static int countSameElements(byte[] arra, int start, byte[] arrb)
public static int find(byte[] arra, int start, int limit, byte[] arrb)
public static int findNotIn(byte[] arra, int start, int limit, byte[] charset)
public static int findIn(byte[] arra, int start, int limit, byte[] charset)
public static int find(byte[] arra, int start, int limit, int b, int c)
public static void intIndexesToBooleanArray(int[] arra, boolean[] arrb)
public static boolean containsAllTrueElements(boolean[] arra, boolean[] arrb)
public static boolean containsAt(byte[] arra, int start, byte[] arrb)
public static int countStartElementsAt(byte[] arra, int start, byte[] arrb)
public static int countNonStartElementsAt(byte[] arra, int start, byte[] arrb)
public static void copyArray(Object source, Object dest, int count)
public static int[] arraySlice(int[] source, int start, int count)
public static void fillArray(Object[] array, Object value)
public static Object duplicateArray(Object source)
public static Object resizeArray(Object source, int newsize)
public static void copyAdjustArray(Object[] source, Object[] dest, Object addition, int colindex, int adjust)
source
- dest
- addition
- colindex
- adjust
- +1 or 0 or -1
return new, adjusted array or null if an element is removedpublic static int[] toAdjustedColumnArray(int[] colarr, int colindex, int adjust)
colarr
- colindex
- adjust
- +1 or 0 or -1
public static void copyColumnValues(Object[] row, int[] colindex, Object[] colobject)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |