Java Doc for ArrayUtil.java in  » Database-DBMS » hsql » org » hsqldb » lib » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » hsql » org.hsqldb.lib 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.hsqldb.lib.ArrayUtil

ArrayUtil
public class ArrayUtil (Code)
Collection of static methods for operations on arrays
author:
   fredt@users
version:
   1.7.2
since:
   1.7.2


Field Summary
final public static  intCLASS_CODE_BOOLEAN
    
final public static  intCLASS_CODE_BYTE
    
final public static  intCLASS_CODE_CHAR
    
final public static  intCLASS_CODE_DOUBLE
    
final public static  intCLASS_CODE_FLOAT
    
final public static  intCLASS_CODE_INT
    
final public static  intCLASS_CODE_LONG
    
final public static  intCLASS_CODE_OBJECT
    
final public static  intCLASS_CODE_SHORT
    


Method Summary
public static  voidadjustArray(int type, Object array, int usedElements, int index, int count)
     Moves the contents of an array to allow both addition and removal of elements.
public static  booleanareEqual(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).
public static  booleanareEqualSets(int[] arra, int[] arrb)
     Returns true if arra and arrb contain the same set of integers, not necessarily in the same order.
public static  int[]arraySlice(int[] source, int start, int count)
     Returns a range of elements of source from start to end of the array.
public static  voidclearArray(int type, Object data, int from, int to)
     Clears an area of the given array of the given type.
public static  int[]commonElements(int[] arra, int[] arrb)
     Returns an int[] containing elements shared between the two arrays arra and arrb.
public static  booleancontainsAllTrueElements(boolean[] arra, boolean[] arrb)
    
public static  booleancontainsAt(byte[] arra, int start, byte[] arrb)
     Returns true if arra from position start contains all elements of arrb in sequential order.
public static  voidcopyAdjustArray(Object source, Object dest, Object addition, int colindex, int adjust)
     Copies elements of source to dest.
public static  voidcopyArray(Object source, Object dest, int count)
     Convenience wrapper for System.arraycopy().
public static  voidcopyColumnValues(Object[] row, int[] colindex, Object[] colobject)
     Copies some elements of row into colobject by using colindex as the list of indexes into row.
public static  voidcopyColumnValues(int[] row, int[] colindex, int[] colobject)
    
public static  intcountCommonElements(int[] arra, int[] arrb)
     Returns the number of elements shared between the two arrays containing sets.

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).

public static  intcountNonStartElementsAt(byte[] arra, int start, byte[] arrb)
     Returns the count of elements in arra from position start that are not among the elements of arrb.
public static  intcountSameElements(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.
public static  intcountStartElementsAt(byte[] arra, int start, byte[] arrb)
     Returns the count of elements in arra from position start that are among the elements of arrb.
public static  ObjectduplicateArray(Object source)
     Returns a duplicates of an array.
public static  voidfillArray(Object[] array, Object value)
     Fills the array with a value.
public static  voidfillArray(int[] array, int value)
    
public static  voidfillSequence(int[] colindex)
    
public static  intfind(Object[] array, Object object)
     Basic find for small arrays of Object.
public static  intfind(int[] array, int value)
     Basic find for small arrays of int.
public static  intfind(byte[] arra, int start, int limit, byte[] arrb)
     Returns the index of the first occurence of arrb in arra.
public static  intfind(byte[] arra, int start, int limit, int b, int c)
     Returns the index of b or c in arra.
public static  intfindIn(byte[] arra, int start, int limit, byte[] charset)
     Returns an index into arra (or -1) where the character is in the charset byte array.
public static  intfindNot(int[] array, int value)
     Finds the first element of the array that is not equal to the given value.
public static  intfindNotIn(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  intgetClassCode(Class cla)
     Returns a distinct int code for each primitive type and for all Object types.
public static  booleanhaveCommonElement(int[] arra, int[] arrb, int bcount)
     Returns true if arra and the first bcount elements of arrb share any element.
public static  booleanhaveEqualArrays(int[] arra, int[] arrb, int count)
    
public static  booleanhaveEqualArrays(Object[] arra, Object[] arrb, int count)
    
public static  booleanhaveEqualSets(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).
public static  voidintIndexesToBooleanArray(int[] arra, boolean[] arrb)
     Set elements of arrb true if their indexes appear in arrb.
public static  ObjectresizeArray(Object source, int newsize)
     Returns a new array of given size, containing as many elements of the original array as it can hold.
public static  ObjectresizeArrayIfDifferent(Object source, int newsize)
     Returns the given array if newsize is the same as existing.
public static  voidsortArray(int[] array)
     Basic sort for small arrays of int.
public static  ObjecttoAdjustedArray(Object source, Object addition, int colindex, int adjust)
     Returns an array containing the elements of parameter source, with one element removed or added.
public static  int[]toAdjustedColumnArray(int[] colarr, int colindex, int adjust)
     Returns a new array with the elements in collar adjusted to reflect changes at colindex.

Field Detail
CLASS_CODE_BOOLEAN
final public static int CLASS_CODE_BOOLEAN(Code)



CLASS_CODE_BYTE
final public static int CLASS_CODE_BYTE(Code)



CLASS_CODE_CHAR
final public static int CLASS_CODE_CHAR(Code)



CLASS_CODE_DOUBLE
final public static int CLASS_CODE_DOUBLE(Code)



CLASS_CODE_FLOAT
final public static int CLASS_CODE_FLOAT(Code)



CLASS_CODE_INT
final public static int CLASS_CODE_INT(Code)



CLASS_CODE_LONG
final public static int CLASS_CODE_LONG(Code)



CLASS_CODE_OBJECT
final public static int CLASS_CODE_OBJECT(Code)



CLASS_CODE_SHORT
final public static int CLASS_CODE_SHORT(Code)





Method Detail
adjustArray
public static void adjustArray(int type, Object array, int usedElements, int index, int count)(Code)
Moves the contents of an array to allow both addition and removal of elements. Used arguments must be in range.
Parameters:
  type - class type of the array
Parameters:
  array - the array
Parameters:
  usedElements - count of elements of array in use
Parameters:
  index - point at which to add or remove elements



areEqual
public static boolean areEqual(int[] arra, int[] arrb, int count, boolean full)(Code)
For full == true returns true if arra and arrb are identical (have the same length and contain the same integers in the same sequence). For full == false returns the result of haveEqualArrays(arra,arrb,count) For full == true, the array lengths must be the same as count



areEqualSets
public static boolean areEqualSets(int[] arra, int[] arrb)(Code)
Returns true if arra and arrb contain the same set of integers, not necessarily in the same order. This implies the arrays are of the same length.



arraySlice
public static int[] arraySlice(int[] source, int start, int count)(Code)
Returns a range of elements of source from start to end of the array.



clearArray
public static void clearArray(int type, Object data, int from, int to)(Code)
Clears an area of the given array of the given type.



commonElements
public static int[] commonElements(int[] arra, int[] arrb)(Code)
Returns an int[] containing elements shared between the two arrays arra and arrb. The arrays contain sets (no value is repeated). Used to find the overlap between two arrays of column indexes. Ordering of the result arrays will be the same as in array a. The method assumes that each index is only listed once in the two input arrays.

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 indexes
Parameters:
  arrb - int[]; second column indexes int[] common indexes or null if there is no overlap.



containsAllTrueElements
public static boolean containsAllTrueElements(boolean[] arra, boolean[] arrb)(Code)
Return true if for each true element in arrb, the corresponding element in arra is true



containsAt
public static boolean containsAt(byte[] arra, int start, byte[] arrb)(Code)
Returns true if arra from position start contains all elements of arrb in sequential order.



copyAdjustArray
public static void copyAdjustArray(Object source, Object dest, Object addition, int colindex, int adjust)(Code)
Copies elements of source to dest. If adjust is -1 the element at colindex is not copied. If adjust is +1 that element is filled with the Object addition. All the rest of the elements in source are shifted left or right accordingly when they are copied. If adjust is 0 the addition is copied over the element at colindex. No checks are perfomed on array sizes and an exception is thrown if they are not consistent with the other arguments.



copyArray
public static void copyArray(Object source, Object dest, int count)(Code)
Convenience wrapper for System.arraycopy().



copyColumnValues
public static void copyColumnValues(Object[] row, int[] colindex, Object[] colobject)(Code)
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 are normally shorter than row.


Parameters:
  row - the source array
Parameters:
  colindex - the list of indexes into row
Parameters:
  colobject - the destination array




copyColumnValues
public static void copyColumnValues(int[] row, int[] colindex, int[] colobject)(Code)



countCommonElements
public static int countCommonElements(int[] arra, int[] arrb)(Code)
Returns the number of elements shared between the two arrays containing sets.

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.
Parameters:
  arra - int[]; first array of column indexes.
Parameters:
  arrb - int[]; second array of column indexes int; number of elements shared by a and b




countNonStartElementsAt
public static int countNonStartElementsAt(byte[] arra, int start, byte[] arrb)(Code)
Returns the count of elements in arra from position start that are not among the elements of arrb.



countSameElements
public static int countSameElements(byte[] arra, int start, byte[] arrb)(Code)
Returns the count of elements in arra from position start that are sequentially equal to the elements of arrb.



countStartElementsAt
public static int countStartElementsAt(byte[] arra, int start, byte[] arrb)(Code)
Returns the count of elements in arra from position start that are among the elements of arrb. Stops at any element not in arrb.



duplicateArray
public static Object duplicateArray(Object source)(Code)
Returns a duplicates of an array.



fillArray
public static void fillArray(Object[] array, Object value)(Code)
Fills the array with a value.



fillArray
public static void fillArray(int[] array, int value)(Code)
Fills the int array with a value



fillSequence
public static void fillSequence(int[] colindex)(Code)



find
public static int find(Object[] array, Object object)(Code)
Basic find for small arrays of Object.



find
public static int find(int[] array, int value)(Code)
Basic find for small arrays of int.



find
public static int find(byte[] arra, int start, int limit, byte[] arrb)(Code)
Returns the index of the first occurence of arrb in arra. Or -1 if not found.



find
public static int find(byte[] arra, int start, int limit, int b, int c)(Code)
Returns the index of b or c in arra. Or -1 if not found.



findIn
public static int findIn(byte[] arra, int start, int limit, byte[] charset)(Code)
Returns an index into arra (or -1) where the character is in the charset byte array.



findNot
public static int findNot(int[] array, int value)(Code)
Finds the first element of the array that is not equal to the given value.



findNotIn
public static int findNotIn(byte[] arra, int start, int limit, byte[] charset)(Code)
Returns an index into arra (or -1) where the character is not in the charset byte array.



getClassCode
static int getClassCode(Class cla)(Code)
Returns a distinct int code for each primitive type and for all Object types.



haveCommonElement
public static boolean haveCommonElement(int[] arra, int[] arrb, int bcount)(Code)
Returns true if arra and the first bcount elements of arrb share any element.

Used for checks for any overlap between two arrays of column indexes.




haveEqualArrays
public static boolean haveEqualArrays(int[] arra, int[] arrb, int count)(Code)
Returns true if the first count elements of arra and arrb are identical subarrays of integers



haveEqualArrays
public static boolean haveEqualArrays(Object[] arra, Object[] arrb, int count)(Code)
Returns true if the first count elements of arra and arrb are identical subarrays of Objects



haveEqualSets
public static boolean haveEqualSets(int[] arra, int[] arrb, int count)(Code)
Returns true if the first count elements of arra and arrb are identical sets of integers (not necessarily in the same order).



intIndexesToBooleanArray
public static void intIndexesToBooleanArray(int[] arra, boolean[] arrb)(Code)
Set elements of arrb true if their indexes appear in arrb.



resizeArray
public static Object resizeArray(Object source, int newsize)(Code)
Returns a new array of given size, containing as many elements of the original array as it can hold. N.B. Always returns a new array even if newsize parameter is the same as the old size.



resizeArrayIfDifferent
public static Object resizeArrayIfDifferent(Object source, int newsize)(Code)
Returns the given array if newsize is the same as existing. Returns a new array of given size, containing as many elements of the original array as it can hold.



sortArray
public static void sortArray(int[] array)(Code)
Basic sort for small arrays of int.



toAdjustedArray
public static Object toAdjustedArray(Object source, Object addition, int colindex, int adjust)(Code)
Returns an array containing the elements of parameter source, with one element removed or added. Parameter adjust {-1, +1} indicates the operation. Parameter colindex indicates the position at which an element is removed or added. Parameter addition is an Object to add when adjust is +1.



toAdjustedColumnArray
public static int[] toAdjustedColumnArray(int[] colarr, int colindex, int adjust)(Code)
Returns a new array with the elements in collar adjusted to reflect changes at colindex.

Each element in collarr represents an index into another array otherarr.

colindex is the index at which an element is added or removed. Each element in the result array represents the new, adjusted index.

For each element of collarr that represents an index equal to colindex and adjust is -1, the result will not contain that element and will be shorter than collar by one element.
Parameters:
  colarr - the source array
Parameters:
  colindex - index at which to perform adjustement
Parameters:
  adjust - +1, 0 or -1 new, adjusted array




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.