/** * Get the element at the given index from the vector. * * @param index position of element * @return element at given index */ public long get(int index) throws IllegalStateException { if (isSet(index) == 0) { throw new IllegalStateException("Value at index is null"); } return valueBuffer.getLong(index * TYPE_WIDTH); }
/** * 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, NullableDateMilliHolder holder) { if (isSet(index) == 0) { holder.isSet = 0; return; } holder.isSet = 1; holder.value = valueBuffer.getLong(index * TYPE_WIDTH); }
/** * Same as {@link #get(int)}. * * @param index position of element * @return element at given index */ public LocalDateTime getObject(int index) { if (isSet(index) == 0) { return null; } else { final long millis = valueBuffer.getLong(index * TYPE_WIDTH); final LocalDateTime localDateTime = new org.joda.time.LocalDateTime(millis, org.joda.time.DateTimeZone.UTC); return localDateTime; } }
/** * 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, DateMilliVector from) { BitVectorHelper.setValidityBit(validityBuffer, thisIndex, from.isSet(fromIndex)); final long value = from.valueBuffer.getLong(fromIndex * TYPE_WIDTH); valueBuffer.setLong(thisIndex * TYPE_WIDTH, value); }
case DATEMILLI : holder = new NullableDateMilliHolder(); ((NullableDateMilliHolder)holder).isSet = ((DateMilliVector) vector).isSet(index); if (((NullableDateMilliHolder)holder).isSet == 1) { ((NullableDateMilliHolder)holder).value = ((DateMilliVector) vector).get(index);