|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object biz.chitec.quarterback.util.QuickIntArray
Storage for int values which provides certain basic operations with speed in mind. QuickIntArray can operate on lists of integer numbers. Namely, they can be stored sorted or unsorted, unique or multiple times. This storage is used especially in relation to database accesses and has at least one special method for this purpose.
This class has been created long before boxing or even the Collections framework became standard techniques. It has its advantages even these days, though, as it leaves all the fancy generic stuff and concentrates just on speed. And that can be archived best by using arrays of simple numeric data types instead of Lists of Object-based wrappers.
Field Summary | |
private static int |
DEFAULTGROWCHUNK
|
private int |
growchunk
|
private boolean |
singular
|
private int |
size
|
private boolean |
sorted
|
private int[] |
xa
|
Constructor Summary | |
QuickIntArray()
Creates empty storage, unsorted and without duplicate prevention. |
|
QuickIntArray(boolean singularx,
boolean sortedx)
Creates empty storage. |
|
QuickIntArray(boolean sgx,
boolean srx,
int szx,
int grx,
int[] xax)
General constructor. |
|
QuickIntArray(java.util.Collection list)
Creates storage out of a List. |
|
QuickIntArray(java.util.Collection list,
boolean singularx,
boolean sortedx)
Creates storage out of a List. |
|
QuickIntArray(int[] ii)
Creates storage out of array of int values. |
|
QuickIntArray(int[] ii,
boolean singularx,
boolean sortedx)
Creates storage out of array of int values. |
|
QuickIntArray(QuickIntArray x)
Copy constructor. |
Method Summary | |
java.util.List |
asList()
Transforms the storage into a ArrayList of Integer objects. |
private void |
checkAndEnlargeArray(int newlyneeded)
Checks whether a new element can be added internally. |
void |
clear()
Deletes all elements |
java.lang.Object |
clone()
Clone method. |
boolean |
contains(int y)
Checks whether the storage contains an integer or not. |
static QuickIntArray |
createQuickIntArray(java.lang.Object orgx)
Creates a QuickIntArray out of a multitude of input parameter types. |
static QuickIntArray |
createQuickIntArrayOrNull(java.lang.Object orgx,
boolean nullonempty)
Creates a QuickIntArray out of a multitude of input parameter types and return null if input is null. |
void |
deleteAt(int idx)
Deletes an element at a certain index position. |
int |
elementAt(int i)
Deprecated. Use get(int) instead. |
int |
get(int i)
Returns the element at the given index. |
int[] |
getContent()
Return content. |
int[] |
getContentPart(int start,
int length)
Return part of the content in an efficient manner. |
int |
getGrowChunk()
Gets the growChunk attribute of the QuickIntArray object |
int |
indexOf(int y)
Returns the (first) index of the given integer in the storage. |
boolean |
insert(int y)
Inserts given number. |
boolean |
insert(int[] y)
Insert content of an int[]-array. |
void |
insert(QuickIntArray qia)
Combines this storage with another one. |
QuickIntArray |
intersectWith(QuickIntArray other)
Generates intersection of this and the other QuickIntArray. |
boolean |
isSingular()
|
boolean |
isSorted()
|
int |
length()
Returns the length (=size) of the storage. |
QuickIntArray |
restWith(QuickIntArray other)
Generates rest of this with respect to other. |
void |
setGrowChunk(int i)
Sets the growChunk attribute of the QuickIntArray object |
java.util.List |
toList()
Transforms the storage into a List of Integer objects. |
java.lang.String |
toString()
generate output for debugging purposes. |
QuickIntArray |
uniteWith(QuickIntArray other)
Generates union of this and the other QuickIntArray. |
java.lang.String |
whereClause(java.lang.String elemnam,
java.lang.String concatenate,
boolean concatafter)
Creates an SQL-where-clause out of the storage's content, like "nr in (1,2,3)". |
java.lang.String |
whereNotClause(java.lang.String elemnam,
java.lang.String concatenate,
boolean concatafter)
Creates an inverted SQL-where-clause out of the storage's content, like "nr not in (1,2,3)". |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final int DEFAULTGROWCHUNK
private int[] xa
private int size
private int growchunk
private boolean singular
private boolean sorted
Constructor Detail |
public QuickIntArray(boolean sgx, boolean srx, int szx, int grx, int[] xax)
sgx
- Sigular flagsrx
- Sorted flagszx
- Number of currently used elements in int[] arraygrx
- growchunkxax
- "real" array. May be larger than QIA's size, in which case additional values do not countpublic QuickIntArray()
public QuickIntArray(boolean singularx, boolean sortedx)
singularx
- Flag whether there must be no duplicate valuessortedx
- Flag whether content is always sortedpublic QuickIntArray(int[] ii, boolean singularx, boolean sortedx)
ii
- Source valuessingularx
- Flag whether there must be no duplicate valuessortedx
- Flag whether content is always sortedpublic QuickIntArray(int[] ii)
ii
- Source valuespublic QuickIntArray(java.util.Collection list, boolean singularx, boolean sortedx)
list
- Source values. Must be solely Number objectssingularx
- Flag whether there must be no duplicate valuessortedx
- Flag whether content is always sortedpublic QuickIntArray(java.util.Collection list)
list
- Description of the Parameterpublic QuickIntArray(QuickIntArray x)
x
- Description of the ParameterMethod Detail |
public boolean isSingular()
public boolean isSorted()
public void setGrowChunk(int i)
i
- The new growChunk valuepublic int getGrowChunk()
public java.lang.Object clone()
private void checkAndEnlargeArray(int newlyneeded)
newlyneeded
- Description of the Parameterpublic void clear()
public int[] getContent()
public int[] getContentPart(int start, int length)
start
- First index to copy.length
- Maximum number of elements to copy.
public boolean insert(int y)
y
- The value to insert
public boolean insert(int[] y)
y
- Array of int values to insert
public void insert(QuickIntArray qia)
qia
- Array of values to insert.public void deleteAt(int idx)
idx
- Index of element to delete. If out of bounds, nothing happens.public boolean contains(int y)
y
- Value to look for
public int indexOf(int y)
y
- Description of the Parameter
public int elementAt(int i)
i
- Description of the Parameter
public int get(int i)
i
- Description of the Parameter
public int length()
public java.util.List toList()
public java.util.List asList()
public java.lang.String whereClause(java.lang.String elemnam, java.lang.String concatenate, boolean concatafter)
elemnam
- Name of the element to substitute in the queryconcatenate
- concatenation literal, usually " and" or " or"concatafter
- Flag whether the concatenation literal should be placed before or after the content
public java.lang.String whereNotClause(java.lang.String elemnam, java.lang.String concatenate, boolean concatafter)
elemnam
- Description of the Parameterconcatenate
- Description of the Parameterconcatafter
- Description of the Parameter
public java.lang.String toString()
public QuickIntArray uniteWith(QuickIntArray other)
other
- Description of the Parameter
public QuickIntArray intersectWith(QuickIntArray other)
other
- Description of the Parameter
public QuickIntArray restWith(QuickIntArray other)
other
- Description of the Parameter
public static QuickIntArray createQuickIntArray(java.lang.Object orgx)
orgx
- Some data to be represented as a QuickIntArray
public static QuickIntArray createQuickIntArrayOrNull(java.lang.Object orgx, boolean nullonempty)
orgx
- Some data to be represented as a QuickIntArraynullonempty
- If true, return also null if the QuickIntArray is empty
createQuickIntArray(Object)
|
QJCC homepage | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |