IntArray (Lucene 3.6.2 API)
Keywords: org.apache.lucene.util.collections.IntArray class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.util.collections
Class IntArray

    java.lang.Object
      org.apache.lucene.util.collections.IntArray

    public class IntArray

extends Object

A Class wrapper for a grow-able int[] which can be sorted and intersect with other IntArrays.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Constructor Summary
`IntArray()` Construct a default IntArray, size 0 and surly a sort should not occur.

Method Summary
`void` | `addToArray(int value)` Adds a value to the array.
`void` | `clear(boolean resize)` Clear the IntArray (set all elements to zero).
`boolean` | `equals(Object o)` Equals method.
`int` | `get(int i)` Get an element from a specific index.
`int` | `hashCode()` Calculates a hash-code for HashTables
`void` | `intersect(IntArray other)` Intersects the data with a given IntArray
`void` | `intersect(IntHashSet set)` Intersects the data with a given `IntHashSet`.
`void` | `set(int idx, int value)`
`int` | `size()` Return the size of the Array.
`void` | `sort()` Sorts the data.
`String` | `toString()` toString or not toString.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### IntArray

    public IntArray()

  Construct a default IntArray, size 0 and surly a sort should not occur.

Method Detail

### intersect

    public void intersect(IntHashSet set)

  Intersects the data with a given `IntHashSet`.

  Parameters:
    `set` - A given ArrayHashSetInt which holds the data to be intersected against

### intersect

    public void intersect(IntArray other)

  Intersects the data with a given IntArray

  Parameters:
    `other` - A given IntArray which holds the data to be intersected agains

### size

    public int size()

  Return the size of the Array. Not the allocated size, but the number of values actually set.

  Returns:
    the (filled) size of the array

### addToArray

    public void addToArray(int value)

  Adds a value to the array.

  Parameters:
    `value` - value to be added

### equals

    public boolean equals(Object o)

  Equals method. Checking the sizes, than the values from the last index to the first (Statistically for random should be the same but for our specific use would find differences faster).

  Overrides:
    `equals` in class `Object`

### sort

    public void sort()

  Sorts the data. If it is needed.

### hashCode

    public int hashCode()

  Calculates a hash-code for HashTables

  Overrides:
    `hashCode` in class `Object`

### get

    public int get(int i)

  Get an element from a specific index.

  Parameters:
    `i` - index of which element should be retrieved.

### set

    public void set(int idx,
                    int value)

### toString

    public String toString()

  toString or not toString. That is the question!

  Overrides:
    `toString` in class `Object`

### clear

    public void clear(boolean resize)

  Clear the IntArray (set all elements to zero).

  Parameters:
    `resize` - - if resize is true, then clear actually allocates a new array of size 0, essentially 'clearing' the array and freeing memory.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD