/** * Get the element at the given index from the vector. * * @param index position of element * @return element at given index */ public int get(int index) throws IllegalStateException { if (isSet(index) == 0) { throw new IllegalStateException("Value at index is null"); } return getBit(index); }
/** * Same as {@link #get(int)}. * * @param index position of element * @return element at given index */ public Boolean getObject(int index) { if (isSet(index) == 0) { return null; } else { return new Boolean(getBit(index) != 0); } }
/** * Get the element at the given index from the vector and * sets the state in holder. If element at given index * is null, holder.isSet will be zero. * * @param index position of element */ public void get(int index, NullableBitHolder holder) { if (isSet(index) == 0) { holder.isSet = 0; return; } holder.isSet = 1; holder.value = getBit(index); }
/** * Copy a cell value from a particular index in source vector to a particular * position in this vector. * * @param fromIndex position to copy from in source vector * @param thisIndex position to copy to in this vector * @param from source vector */ public void copyFrom(int fromIndex, int thisIndex, BitVector from) { BitVectorHelper.setValidityBit(validityBuffer, thisIndex, from.isSet(fromIndex)); BitVectorHelper.setValidityBit(valueBuffer, thisIndex, from.getBit(fromIndex)); }
case BIT : holder = new NullableBitHolder(); ((NullableBitHolder)holder).isSet = ((BitVector) vector).isSet(index); if (((NullableBitHolder)holder).isSet == 1) { ((NullableBitHolder)holder).value = ((BitVector) vector).get(index);