public short get( int key ) { synchronized( mutex ) { return m.get( key ); } }
/** * Retrieves the value for <tt>key</tt> * * @param key an <code>Object</code> value * @return the value of <tt>key</tt> or null if no such mapping exists. */ public Short get( Object key ) { int k; if ( key != null ) { if ( key instanceof Integer ) { k = unwrapKey( key ); } else { return null; } } else { k = _map.getNoEntryKey(); } short v = _map.get( k ); // There may be a false positive since primitive maps // cannot return null, so we have to do an extra // check here. if ( v == _map.getNoEntryValue() ) { return null; } else { return wrapValue( v ); } }
/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TIntShortMap ) ) { return false; } TIntShortMap that = ( TIntShortMap ) other; if ( that.size() != this.size() ) { return false; } short[] values = _values; byte[] states = _states; short this_no_entry_value = getNoEntryValue(); short that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { int key = _set[i]; short that_value = that.get( key ); short this_value = values[i]; if ( ( this_value != that_value ) && ( this_value != this_no_entry_value ) && ( that_value != that_no_entry_value ) ) { return false; } } } return true; }
public short get( int key) { return m.get( key ); }
/** * Retrieves the value for <tt>key</tt> * * @param key an <code>Object</code> value * @return the value of <tt>key</tt> or null if no such mapping exists. */ @Override public Short get( Object key ) { if (! ( key instanceof Integer ) ) { return null; } int k = unwrapKey( key ); short v = _map.get( k ); if (v == _map.getNoEntryValue() && !_map.containsKey( k ) ) { return null; } return wrapValue( v ); }
public short get( int key ) { synchronized( mutex ) { return m.get( key ); } }
@Override public short get( int key ) { synchronized( mutex ) { return m.get( key ); } }
public short get( int key ) { synchronized( mutex ) { return m.get( key ); } }
@Override public short get( int key) { return m.get( key ); }
public short get( int key ) { synchronized( mutex ) { return m.get( key ); } }
public short get( int key) { return m.get( key ); }
public short get( int key) { return m.get( key ); }
public short get( int key) { return m.get( key ); }
@Override public final ZonedDateTime getValue(int index) { this.checkBounds(index, length); final long value = values.get(index); if (value == nullValue) { return null; } else { final ZoneId zone = zoneIdMap2.get(zoneIds.get(index)); final Instant instant = Instant.ofEpochMilli(value); return ZonedDateTime.ofInstant(instant, zone); } }
@Override public final void write(ObjectOutputStream os, int[] indexes) throws IOException { for (int index : indexes) { final long value = getLong(index); os.writeLong(value); if (value != defaultValueAsLong) { final short zoneId = zoneIds.get(index); os.writeShort(zoneId); } } } }
@Override public final boolean isEqualTo(int index, ZonedDateTime value) { if (value == null) { return isNull(index); } else { final long epochMills = value.toInstant().toEpochMilli(); if (epochMills != values.get(index)) { return false; } else { final ZoneId zoneId = value.getZone(); final short code1 = zoneIdMap1.get(zoneId); final short code2 = zoneIds.get(index); return code1 == code2; } } }
@Override() public final Array<ZonedDateTime> copy(int[] indexes) { final SparseArrayOfZonedDateTimes clone = new SparseArrayOfZonedDateTimes(indexes.length, defaultValue); for (int i = 0; i < indexes.length; ++i) { final long value = getLong(indexes[i]); if (value != defaultValueAsLong) { clone.values.put(i, value); clone.zoneIds.put(i, this.zoneIds.get(i)); } } return clone; }
@Override() public final Array<ZonedDateTime> copy(int start, int end) { final int length = end - start; final SparseArrayOfZonedDateTimes clone = new SparseArrayOfZonedDateTimes(length, defaultValue); for (int i=0; i<length; ++i) { final long value = getLong(start+i); if (value != defaultValueAsLong) { final short zoneId = zoneIds.get(start+i); clone.setLong(i, value); clone.zoneIds.put(i, zoneId); } } return clone; }
@Override public final Array<ZonedDateTime> update(int toIndex, Array<ZonedDateTime> from, int fromIndex, int length) { if (from instanceof SparseArrayOfZonedDateTimes) { final SparseArrayOfZonedDateTimes other = (SparseArrayOfZonedDateTimes)from; for (int i=0; i<length; ++i) { this.values.put(toIndex + i, other.values.get(fromIndex + i)); this.zoneIds.put(toIndex + i, other.zoneIds.get(fromIndex + i)); } } else { for (int i=0; i<length; ++i) { final ZonedDateTime update = from.getValue(fromIndex + i); this.setValue(toIndex + i, update); } } return this; }
@Override public final long setLong(int index, long value) { this.checkBounds(index, length); final long oldValue = getLong(index); if (value == defaultValueAsLong) { this.values.remove(index); this.zoneIds.remove(index); return oldValue; } else { final short zoneId = zoneIds.get(index); this.values.put(index, value); this.zoneIds.put(index, zoneId != NULL_ZONE ? zoneId : UTC_ZONE); return oldValue; } }